Skip to content

Commit

Permalink
feat: remove languageOptions and prefer rule config
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Jan 21, 2025
1 parent 7164e32 commit c686de8
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 77 deletions.
32 changes: 29 additions & 3 deletions dist/definitions/eslint-plugin.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
import type { ESLint } from "eslint";
declare const eslintPlugin: ESLint.Plugin;
export default eslintPlugin;
declare const checkPackagePlugin: {
languages: {
"package-json": any;
};
rules: {
[x: string]: import("eslint").Rule.RuleModule;
};
configs: {
recommended: {
files: string[];
language: string;
plugins: {};
rules: {
"check-package-dependencies/exact-versions": "error";
};
};
"recommended-library": {
files: string[];
language: string;
plugins: {};
rules: {
"check-package-dependencies/exact-versions": ["error", {
dependencies: boolean;
}];
};
};
};
};
export default checkPackagePlugin;
//# sourceMappingURL=eslint-plugin.d.ts.map
2 changes: 1 addition & 1 deletion dist/definitions/eslint-plugin.d.ts.map

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

2 changes: 1 addition & 1 deletion dist/definitions/eslint/rules.d.ts.map

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

23 changes: 20 additions & 3 deletions dist/eslint-plugin.js

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

2 changes: 1 addition & 1 deletion dist/eslint-plugin.js.map

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

33 changes: 14 additions & 19 deletions dist/eslint/rules.js

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

2 changes: 1 addition & 1 deletion dist/eslint/rules.js.map

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

16 changes: 1 addition & 15 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,5 @@ export default [
{
ignores: ["vite.config.ts"],
},
{
files: ["package.json"],
language: "check-package-dependencies/package-json",
languageOptions: { isLibrary: true },
plugins: {
"check-package-dependencies": checkPackagePlugin,
},
rules: {
"check-package-dependencies/exact-versions": "error",
// "check-package-dependencies/resolutions-versions-match": "error",
// "check-package-dependencies/direct-peer-dependencies": "error",
// "check-package-dependencies/direct-duplicate-dependencies": "error",
// "check-package-dependencies/resolutions-has-explanation": "error",
},
},
checkPackagePlugin.configs["recommended-library"],
];
25 changes: 22 additions & 3 deletions src/eslint-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ESLint } from "eslint";
import { PackageJSONLanguage } from "./eslint/language.ts";
import packageRules from "./eslint/rules.ts";

const eslintPlugin: ESLint.Plugin = {
const checkPackagePlugin = {
languages: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
"package-json": PackageJSONLanguage as any,
Expand All @@ -14,7 +14,7 @@ const eslintPlugin: ESLint.Plugin = {
recommended: {
files: ["package.json"],
language: "check-package-dependencies/package-json",
plugins: ["check-package-dependencies"],
plugins: {},
rules: {
"check-package-dependencies/exact-versions": "error",
// "check-package-dependencies/resolutions-versions-match": "error",
Expand All @@ -23,7 +23,26 @@ const eslintPlugin: ESLint.Plugin = {
// "check-package-dependencies/resolutions-has-explanation": "error",
},
},
"recommended-library": {
files: ["package.json"],
language: "check-package-dependencies/package-json",
plugins: {},
rules: {
"check-package-dependencies/exact-versions": [
"error",
{ dependencies: false },
],
},
},
},
} satisfies ESLint.Plugin;

checkPackagePlugin.configs.recommended.plugins = {
"check-package-dependencies": checkPackagePlugin,
};

checkPackagePlugin.configs["recommended-library"].plugins = {
"check-package-dependencies": checkPackagePlugin,
};

export default eslintPlugin;
export default checkPackagePlugin;
Loading

0 comments on commit c686de8

Please sign in to comment.