From 585367c9c494748517c5c736fc7ccab6c0a55370 Mon Sep 17 00:00:00 2001 From: michael faith Date: Thu, 26 Dec 2024 14:40:17 -0600 Subject: [PATCH] build: add eslint-plugin plugin to project's lint config This change adds the `eslint-plugin-eslint-plugin` recommended config to the project's lint configuration, and disables the current 25 errors, for addressing as follow-up changes. --- .eslintrc.cjs | 1 + package.json | 1 + pnpm-lock.yaml | 15 +++++++++++++++ src/rules/order-properties.ts | 2 ++ src/rules/repository-shorthand.ts | 1 + src/rules/sort-collections.ts | 2 ++ src/rules/unique-dependencies.ts | 1 + src/rules/valid-local-dependency.ts | 3 +++ src/rules/valid-name.ts | 1 + src/rules/valid-package-def.ts | 2 ++ src/rules/valid-repository-directory.ts | 2 ++ src/rules/valid-version.ts | 1 + 12 files changed, 32 insertions(+) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 6df2e840..68779a1c 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -7,6 +7,7 @@ module.exports = { extends: [ "eslint:recommended", "plugin:eslint-comments/recommended", + "plugin:eslint-plugin/recommended", "plugin:n/recommended", "plugin:perfectionist/recommended-natural", "plugin:regexp/recommended", diff --git a/package.json b/package.json index 779d5e47..aa83f89e 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "eslint-doc-generator": "^2.0.0", "eslint-plugin-deprecation": "^3.0.0", "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-eslint-plugin": "^6.4.0", "eslint-plugin-jsdoc": "^50.0.0", "eslint-plugin-jsonc": "^2.12.2", "eslint-plugin-markdown": "^3.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 37ceb25c..a362c66b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,6 +84,9 @@ importers: eslint-plugin-eslint-comments: specifier: ^3.2.0 version: 3.2.0(eslint@8.57.1) + eslint-plugin-eslint-plugin: + specifier: ^6.4.0 + version: 6.4.0(eslint@8.57.1) eslint-plugin-jsdoc: specifier: ^50.0.0 version: 50.6.1(eslint@8.57.1) @@ -1885,6 +1888,12 @@ packages: peerDependencies: eslint: '>=4.19.1' + eslint-plugin-eslint-plugin@6.4.0: + resolution: {integrity: sha512-X94/hr7DnckX68wE6Qqeo3DsZndZSclfoewjwD249yG5z2EAOl3UGUohLIgOpmbUjcFv6AlfW3wxBnOiWkS1Iw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.23.0' + eslint-plugin-jsdoc@50.6.1: resolution: {integrity: sha512-UWyaYi6iURdSfdVVqvfOs2vdCVz0J40O/z/HTsv2sFjdjmdlUI/qlKLOTmwbPQ2tAfQnE5F9vqx+B+poF71DBQ==} engines: {node: '>=18'} @@ -5651,6 +5660,12 @@ snapshots: eslint: 8.57.1 ignore: 5.3.2 + eslint-plugin-eslint-plugin@6.4.0(eslint@8.57.1): + dependencies: + '@eslint-community/eslint-utils': 4.4.1(eslint@8.57.1) + eslint: 8.57.1 + estraverse: 5.3.0 + eslint-plugin-jsdoc@50.6.1(eslint@8.57.1): dependencies: '@es-joy/jsdoccomment': 0.49.0 diff --git a/src/rules/order-properties.ts b/src/rules/order-properties.ts index f6c056f5..85fe2b22 100644 --- a/src/rules/order-properties.ts +++ b/src/rules/order-properties.ts @@ -101,6 +101,7 @@ export const rule = createRule({ ); }, loc: properties[i].loc, + // eslint-disable-next-line eslint-plugin/prefer-message-ids message: `Package top-level property "${value}" is not ordered in the npm standard way. Run the ESLint auto-fixer to correct.`, }); } @@ -108,6 +109,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/prefer-message-ids, eslint-plugin/require-meta-type meta: { docs: { category: "Best Practices", diff --git a/src/rules/repository-shorthand.ts b/src/rules/repository-shorthand.ts index fc4c60e1..bfeabc58 100644 --- a/src/rules/repository-shorthand.ts +++ b/src/rules/repository-shorthand.ts @@ -131,6 +131,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/require-meta-type meta: { docs: { category: "Best Practices", diff --git a/src/rules/sort-collections.ts b/src/rules/sort-collections.ts index 23ce4b4c..9daebc71 100644 --- a/src/rules/sort-collections.ts +++ b/src/rules/sort-collections.ts @@ -115,6 +115,7 @@ export const rule = createRule({ ); }, loc: collection.loc, + // eslint-disable-next-line eslint-plugin/prefer-message-ids message: "Package {{ key }} are not alphabetized", node: node as unknown as ESTree.Node, }); @@ -124,6 +125,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/prefer-message-ids, eslint-plugin/require-meta-type meta: { docs: { category: "Best Practices", diff --git a/src/rules/unique-dependencies.ts b/src/rules/unique-dependencies.ts index 1d7a564e..0a3fdf13 100644 --- a/src/rules/unique-dependencies.ts +++ b/src/rules/unique-dependencies.ts @@ -92,6 +92,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/require-meta-schema, eslint-plugin/require-meta-type meta: { docs: { category: "Best Practices", diff --git a/src/rules/valid-local-dependency.ts b/src/rules/valid-local-dependency.ts index 64603bcf..4b066dcb 100644 --- a/src/rules/valid-local-dependency.ts +++ b/src/rules/valid-local-dependency.ts @@ -31,12 +31,14 @@ export const rule = createRule({ try { if (!require.resolve(filePath)) { context.report({ + // eslint-disable-next-line eslint-plugin/prefer-message-ids message: `The package ${key} does not exist given the specified path: ${value}.`, node: context.sourceCode.ast, }); } } catch { context.report({ + // eslint-disable-next-line eslint-plugin/prefer-message-ids message: `The package ${key} does not exist given the specified path: ${value}.`, node: context.sourceCode.ast, }); @@ -56,6 +58,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/require-meta-schema, eslint-plugin/require-meta-type, eslint-plugin/prefer-message-ids meta: { docs: { category: "Best Practices", diff --git a/src/rules/valid-name.ts b/src/rules/valid-name.ts index 38ef972b..e4422765 100644 --- a/src/rules/valid-name.ts +++ b/src/rules/valid-name.ts @@ -55,6 +55,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/require-meta-type, eslint-plugin/require-meta-schema meta: { docs: { category: "Best Practices", diff --git a/src/rules/valid-package-def.ts b/src/rules/valid-package-def.ts index 301d9ada..b88aa40e 100644 --- a/src/rules/valid-package-def.ts +++ b/src/rules/valid-package-def.ts @@ -25,6 +25,7 @@ export const rule = createRule({ validation.errors?.filter(isUsableError).forEach((message) => { if (message) { context.report({ + // eslint-disable-next-line eslint-plugin/prefer-message-ids message, node: context.sourceCode.ast, }); @@ -34,6 +35,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/prefer-message-ids, eslint-plugin/require-meta-type, eslint-plugin/require-meta-schema meta: { docs: { category: "Best Practices", diff --git a/src/rules/valid-repository-directory.ts b/src/rules/valid-repository-directory.ts index 70c39ad8..e55dc646 100644 --- a/src/rules/valid-repository-directory.ts +++ b/src/rules/valid-repository-directory.ts @@ -118,6 +118,7 @@ export const rule = createRule({ `"${expected}"`, ); }, + // eslint-disable-next-line eslint-plugin/no-missing-placeholders messageId: "replace", }, ], @@ -128,6 +129,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/require-meta-type, eslint-plugin/require-meta-schema meta: { docs: { category: "Best Practices", diff --git a/src/rules/valid-version.ts b/src/rules/valid-version.ts index 76b33342..54edabdc 100644 --- a/src/rules/valid-version.ts +++ b/src/rules/valid-version.ts @@ -32,6 +32,7 @@ export const rule = createRule({ }; }, + // eslint-disable-next-line eslint-plugin/require-meta-type, eslint-plugin/require-meta-schema meta: { docs: { category: "Best Practices",