Skip to content

Commit

Permalink
build: add eslint-plugin plugin to project's lint config (#708)
Browse files Browse the repository at this point in the history
<!-- πŸ‘‹ Hi, thanks for sending a PR to eslint-plugin-package-json! πŸ’–.
Please fill out all fields below and make sure each item is true and [x]
checked.
Otherwise we may not be able to review your PR. -->

## PR Checklist

-   [x] Addresses an existing open issue: fixes #82 
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

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.

Closes #82
  • Loading branch information
michaelfaith authored Dec 27, 2024
1 parent 2e5f501 commit 7accdba
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/rules/order-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ export const rule = createRule<Options>({
);
},
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.`,
});
}
},
};
},

// eslint-disable-next-line eslint-plugin/prefer-message-ids, eslint-plugin/require-meta-type
meta: {
docs: {
category: "Best Practices",
Expand Down
1 change: 1 addition & 0 deletions src/rules/repository-shorthand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const rule = createRule<Options>({
};
},

// eslint-disable-next-line eslint-plugin/require-meta-type
meta: {
docs: {
category: "Best Practices",
Expand Down
2 changes: 2 additions & 0 deletions src/rules/sort-collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const rule = createRule<Options>({
);
},
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,
});
Expand All @@ -124,6 +125,7 @@ export const rule = createRule<Options>({
};
},

// eslint-disable-next-line eslint-plugin/prefer-message-ids, eslint-plugin/require-meta-type
meta: {
docs: {
category: "Best Practices",
Expand Down
1 change: 1 addition & 0 deletions src/rules/unique-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/rules/valid-local-dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/rules/valid-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/rules/valid-package-def.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/rules/valid-repository-directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export const rule = createRule({
`"${expected}"`,
);
},
// eslint-disable-next-line eslint-plugin/no-missing-placeholders
messageId: "replace",
},
],
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/rules/valid-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 7accdba

Please sign in to comment.