diff --git a/storefront/.eslintrc.js b/storefront/.eslintrc.js index 89340237a2..f66fd52422 100644 --- a/storefront/.eslintrc.js +++ b/storefront/.eslintrc.js @@ -1,6 +1,3 @@ -const rulesDirPlugin = require('eslint-plugin-rulesdir'); -rulesDirPlugin.RULES_DIR = 'eslint-rules'; - module.exports = { env: { browser: true, @@ -39,7 +36,7 @@ module.exports = { tsconfigRootDir: __dirname, project: ['tsconfig.json'], // Specify it only for TypeScript files }, - plugins: ['react', 'unused-imports', '@typescript-eslint', 'react-hooks', 'no-relative-import-paths', 'rulesdir'], + plugins: ['react', 'unused-imports', '@typescript-eslint', 'react-hooks', 'no-relative-import-paths'], rules: { 'array-callback-return': 'error', 'block-scoped-var': 'error', @@ -136,14 +133,6 @@ module.exports = { { "allowSameFolder": true } ], }, - "overrides": [ - { - "files": ["components/**/*.tsx",], - "rules": { - 'rulesdir/no-helpers-are-exported-from-component-file': 'error', - } - } - ], settings: { react: { version: 'detect', diff --git a/storefront/eslint-rules/no-helpers-are-exported-from-component-file.js b/storefront/eslint-rules/no-helpers-are-exported-from-component-file.js deleted file mode 100644 index 9b35090ceb..0000000000 --- a/storefront/eslint-rules/no-helpers-are-exported-from-component-file.js +++ /dev/null @@ -1,32 +0,0 @@ -module.exports = { - meta: { - type: 'problem', - docs: { - description: 'Enforce that no other functions besides the component are exported from a .tsx file. ', - }, - }, - create: function (context) { - return { - ExportNamedDeclaration(node) { - if (node.declaration.type === 'VariableDeclaration') { - for (const declaration of node.declaration.declarations) { - if ( - declaration && - declaration.type === 'VariableDeclarator' && - declaration.init.type === 'ArrowFunctionExpression' && - declaration.id.type === 'Identifier' && - declaration.id.name.match(/^[a-z]/) && - !declaration.id.name.match(/\buse[A-Z][a-zA-Z]*\b/) - ) { - context.report({ - node, - message: - 'No other functions besides the component should be exported in this file. Move other functions to a helper file.', - }); - } - } - } - }, - }; - }, -}; diff --git a/storefront/package.json b/storefront/package.json index 1eb0c60018..23ab9e3cec 100644 --- a/storefront/package.json +++ b/storefront/package.json @@ -91,7 +91,6 @@ "eslint-plugin-no-relative-import-paths": "1.5.2", "eslint-plugin-react": "7.32.2", "eslint-plugin-react-hooks": "4.6.0", - "eslint-plugin-rulesdir": "0.2.2", "eslint-plugin-unused-imports": "2.0.0", "graphql-markdown": "7.0.0", "i18next-parser": "5.0.0", diff --git a/storefront/pnpm-lock.yaml b/storefront/pnpm-lock.yaml index b877e10320..83d2d468c3 100644 --- a/storefront/pnpm-lock.yaml +++ b/storefront/pnpm-lock.yaml @@ -205,9 +205,6 @@ devDependencies: eslint-plugin-react-hooks: specifier: 4.6.0 version: 4.6.0(eslint@8.35.0) - eslint-plugin-rulesdir: - specifier: 0.2.2 - version: 0.2.2 eslint-plugin-unused-imports: specifier: 2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.59.1)(eslint@8.35.0) @@ -4349,11 +4346,6 @@ packages: string.prototype.matchall: 4.0.10 dev: true - /eslint-plugin-rulesdir@0.2.2: - resolution: {integrity: sha512-qhBtmrWgehAIQeMDJ+Q+PnOz1DWUZMPeVrI0wE9NZtnpIMFUfh3aPKFYt2saeMSemZRrvUtjWfYwepsC8X+mjQ==} - engines: {node: '>=4.0.0'} - dev: true - /eslint-plugin-unused-imports@2.0.0(@typescript-eslint/eslint-plugin@5.59.1)(eslint@8.35.0): resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}