diff --git a/README.md b/README.md index 2e95af12..908c2ad4 100644 --- a/README.md +++ b/README.md @@ -79,8 +79,8 @@ module.exports = [ 💼 [Configurations](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets) enabled in.\ ✅ Set in the `recommended` [configuration](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets).\ 🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\ -💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).\ -💭 Requires type information. +💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).\ +💭 Requires [type information](https://typescript-eslint.io/linting/typed-linting). ### Rules diff --git a/docs/rules/no-only-tests.md b/docs/rules/no-only-tests.md index d5db7dd0..3e8828c1 100644 --- a/docs/rules/no-only-tests.md +++ b/docs/rules/no-only-tests.md @@ -2,7 +2,7 @@ 💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets). -💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions). +💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions). diff --git a/docs/rules/no-property-in-node.md b/docs/rules/no-property-in-node.md index 22da26dd..1a44c31c 100644 --- a/docs/rules/no-property-in-node.md +++ b/docs/rules/no-property-in-node.md @@ -1,6 +1,6 @@ # Disallow using `in` to narrow node types instead of looking at properties (`eslint-plugin/no-property-in-node`) -💭 This rule requires type information. +💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting). diff --git a/docs/rules/require-meta-schema.md b/docs/rules/require-meta-schema.md index de1b6825..c479d257 100644 --- a/docs/rules/require-meta-schema.md +++ b/docs/rules/require-meta-schema.md @@ -2,7 +2,7 @@ 💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets). -💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions). +💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions). diff --git a/eslint-remote-tester.config.js b/eslint-remote-tester.config.js index f9d44f69..daf06010 100644 --- a/eslint-remote-tester.config.js +++ b/eslint-remote-tester.config.js @@ -41,10 +41,13 @@ module.exports = { /** Optional boolean flag used to enable caching of cloned repositories. For CIs it's ideal to disable caching. Defaults to true. */ cache: false, + pathIgnorePattern: 'fixtures', + /** ESLint configuration */ eslintrc: { + root: true, extends: ['plugin:eslint-plugin/all'], - + // ignorePatterns: ['fixtures/**/*'], // not working somehow - using `pathIgnorePattern` as of now. overrides: [ { files: ['*.ts', '*.mts', '*.cts'], diff --git a/lib/utils.js b/lib/utils.js index da5faa74..ae708f80 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -139,15 +139,24 @@ function getRuleExportsESM(ast, scopeManager) { possibleNodes.push(specifier.local); } if (statement.declaration) { - if (statement.declaration.type === 'VariableDeclaration') { - for (const declarator of statement.declaration.declarations) { - if (declarator.init) { - possibleNodes.push(declarator.init); - } - } - } else { - possibleNodes.push(statement.declaration); - } + const nodes = + statement.declaration.type === 'VariableDeclaration' + ? statement.declaration.declarations.map( + (declarator) => declarator.init + ) + : [statement.declaration]; + + // named exports like `export const rule = { ... };` + // skip if it's function-style to avoid false positives + // refs: https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/450 + possibleNodes.push( + ...nodes.filter( + (node) => + node && + node.type !== 'FunctionDeclaration' && + node.type !== 'FunctionExpression' + ) + ); } break; } diff --git a/package.json b/package.json index 792a8c97..51511b35 100644 --- a/package.json +++ b/package.json @@ -64,14 +64,14 @@ "eslint": "^8.23.0", "eslint-config-not-an-aardvark": "^2.1.0", "eslint-config-prettier": "^8.5.0", - "eslint-doc-generator": "^1.6.1", + "eslint-doc-generator": "^1.7.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-plugin": "file:./", "eslint-plugin-markdown": "^3.0.0", "eslint-plugin-n": "^16.6.2", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-unicorn": "^46.0.0", - "eslint-remote-tester": "^3.0.0", + "eslint-remote-tester": "^3.0.1", "eslint-scope": "^7.1.1", "espree": "^9.4.0", "globals": "^13.20.0", diff --git a/tests/lib/utils.js b/tests/lib/utils.js index e90ecd6e..0e8c83ea 100644 --- a/tests/lib/utils.js +++ b/tests/lib/utils.js @@ -86,6 +86,14 @@ describe('utils', () => { 'export default function () { return {}; }', 'export default function (foo, bar) { return {}; }', + // named export of functions + // refs: https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/450 + 'export function foo(options) { return {}; }', + 'export async function foo(options) { return {}; }', + 'export const foo = function (options) { return {}; }', + 'export function foo(options) { return; }', + 'export function foo({opt1, opt2}) { return {}; }', + // Incorrect TypeScript helper structure: 'export default foo()({ create() {}, meta: {} });', 'export default foo().bar({ create() {}, meta: {} });',