Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 0 additions & 158 deletions .eslintrc

This file was deleted.

54 changes: 54 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module.exports = {
root: true,
extends: [
'plugin:@wordpress/eslint-plugin/recommended-with-formatting',
'plugin:eslint-comments/recommended',
],
env: {
browser: false,
es6: true,
node: true,
mocha: true,
},
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
ClipboardJS: true,
rankMath: true,
rankMathAdmin: true,
rankMathEditor: true,
tinymce: true,

// Elementor
$e: true,
elementor: true,
elementorCommon: true,
ElementorConfig: true,
},
settings: {
react: {
pragma: 'wp',
},
jsdoc: {
preferredTypes: [ 'jqXHR' ],
},
},
rules: {
semi: [ 1, 'never' ],
'semi-spacing': 'error',

// jsdoc.
'jsdoc/check-access': 'off',
'jsdoc/require-property': 'off',
'jsdoc/require-property-type': 'off',
'jsdoc/require-property-name': 'off',
'jsdoc/require-property-description': 'off',
'jsdoc/check-property-names': 'off',
'jsdoc/empty-tags': 'off',
'import/no-unresolved': 'off',
},
}
2 changes: 1 addition & 1 deletion dist/analyzer.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"eslint-plugin-eslint-comments": "^3.2.0",
"parse-english": "^4.1.3"
},
"jest": {
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/cleanText.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import normalizeQuotes from '@helpers/normalizeQuotes'
import normalizeWhitespace from '@helpers/normalizeWhitespace'
import stripHTMLComments from '@helpers/stripHTMLComments'
import stripHTMLEntities from '@helpers/stripHTMLEntities'
import stripTocBlockContent from '@helpers/stripTocBlockContent'

/**
* Clean HTML strip all html entities and comments.
Expand All @@ -28,6 +29,7 @@ export function cleanHTML( text ) {
normalizeWhitespace,
stripStyle,
stripScript,
stripTocBlockContent,
stripHTMLComments,
stripHTMLEntities,
stripSpaces,
Expand Down
9 changes: 9 additions & 0 deletions src/helpers/stripTocBlockContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Replace all content within the TOC block from the given string.
*
* @param {string} text The text to remove the TOC content for.
*
* @return {string} The text after TOC content is removed.
*/
export default ( text ) => text
.replace( /<!-- wp:rank-math\/toc-block([\s\S]*?)<!-- \/wp:rank-math\/toc-block -->/g, '' )