Skip to content

Commit

Permalink
chore: bump ESLint to 9, with related dependencies (#733)
Browse files Browse the repository at this point in the history
## PR Checklist

-   [x] Addresses an existing open issue: fixes #732
- [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

Removes `npmpackagejsonlint` since that's covered by this very plugin
now.

There should be no functional runtime changes. Just reorderings from the
newer version of `eslint-plugin-perfectionist`.

💖
  • Loading branch information
JoshuaKGoldberg authored Jan 15, 2025
1 parent 78b3efd commit f37aa93
Show file tree
Hide file tree
Showing 16 changed files with 486 additions and 1,263 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

161 changes: 0 additions & 161 deletions .eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Each should be shown in VS Code, and can be run manually on the command-line:
- `pnpm lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files
- `pnpm lint:knip` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports
- `pnpm lint:md` ([Markdownlint](https://github.com/DavidAnson/markdownlint)): Checks Markdown source files
- `pnpm lint:package-json` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the `package.json` file
- `pnpm lint:packages` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the `pnpm-lock.yml` file
- `pnpm lint:spelling` ([cspell](https://cspell.org)): Spell checks across all source files

Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/lint-package-json.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .npmpackagejsonlintrc.json

This file was deleted.

107 changes: 107 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
const comments = require("@eslint-community/eslint-plugin-eslint-comments/configs");
const eslint = require("@eslint/js");
const vitest = require("@vitest/eslint-plugin");
const eslintPlugin = require("eslint-plugin-eslint-plugin");
const jsdoc = require("eslint-plugin-jsdoc");
const jsonc = require("eslint-plugin-jsonc");
const markdown = require("eslint-plugin-markdown");
const n = require("eslint-plugin-n");
const perfectionist = require("eslint-plugin-perfectionist");
const regexp = require("eslint-plugin-regexp");
const yml = require("eslint-plugin-yml");
const tseslint = require("typescript-eslint");

module.exports = tseslint.config(
{
ignores: [
"**/*.snap",
"coverage*",
"lib",
"node_modules",
"pnpm-lock.yaml",
],
},
{ linterOptions: { reportUnusedDisableDirectives: "error" } },
eslint.configs.recommended,
eslintPlugin.configs["flat/recommended"],
comments.recommended,
jsdoc.configs["flat/contents-typescript-error"],
jsdoc.configs["flat/logical-typescript-error"],
jsdoc.configs["flat/stylistic-typescript-error"],
jsonc.configs["flat/recommended-with-json"],
markdown.configs.recommended,
n.configs["flat/recommended"],
perfectionist.configs["recommended-natural"],
regexp.configs["flat/recommended"],
{
extends: [
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
],
files: ["**/*.js", "**/*.ts"],
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: [
"*.config.*s",
"bin/*.js",
"src/tests/*.js",
],
},
tsconfigRootDir: __dirname,
},
},
rules: {
"@typescript-eslint/no-require-imports": "off",
"jsdoc/match-description": "off",
"n/no-missing-import": "off",

// Stylistic concerns that don't interfere with Prettier
"logical-assignment-operators": [
"error",
"always",
{ enforceForIfStatements: true },
],
"no-useless-rename": "error",
"object-shorthand": "error",
"operator-assignment": "error",
},
settings: {
perfectionist: { partitionByComment: true, type: "natural" },
},
},
{
extends: [tseslint.configs.disableTypeChecked],
files: ["**/*.md/*.js", "**/*.md/*.ts", "eslint.config.js"],
},
{
files: ["**/*.md/*.jsonc"],
rules: {
"jsonc/comma-dangle": "off",
"jsonc/no-comments": "off",
},
},
{
extends: [vitest.configs.recommended],
files: ["**/*.test.*"],
rules: { "@typescript-eslint/no-unsafe-assignment": "off" },
},
{
extends: [
yml.configs["flat/recommended"],
yml.configs["flat/prettier"],
],
files: ["**/*.{yml,yaml}"],
rules: {
"yml/file-extension": ["error", { extension: "yml" }],
"yml/sort-keys": [
"error",
{ order: { type: "asc" }, pathPattern: "^.*$" },
],
"yml/sort-sequence-values": [
"error",
{ order: { type: "asc" }, pathPattern: "^.*$" },
],
},
},
);
2 changes: 1 addition & 1 deletion knip.jsonc → knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://unpkg.com/knip@latest/schema.json",
"entry": ["src/index.ts!"],
"ignoreExportsUsedInFile": { "interface": true, "type": true },
"project": ["src/**/*.ts!"],
"project": ["src/**/*.ts!"]
}
45 changes: 19 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@
"scripts": {
"build": "tsup",
"format": "prettier \"**/*\" --ignore-unknown",
"lint": "eslint . .*js --max-warnings 0 --report-unused-disable-directives",
"lint": "eslint . --max-warnings 0",
"lint:eslint-docs": "npm run update:eslint-docs -- --check",
"lint:knip": "knip",
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\"",
"lint:package-json": "npmPkgJsonLint ./package.json",
"lint:packages": "pnpm dedupe --check",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
"prepare": "husky",
Expand All @@ -68,50 +67,44 @@
"validate-npm-package-name": "^6.0.0"
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
"@eslint/js": "^9.18.0",
"@release-it/conventional-changelog": "^10.0.0",
"@types/eslint": "^8.56.2",
"@types/estree": "^1.0.5",
"@types/estree": "^1.0.6",
"@types/node": "^22.0.0",
"@types/package-json-validator": "^0.6.1",
"@types/semver": "^7.5.6",
"@types/sort-object-keys": "^1.1.3",
"@types/validate-npm-package-name": "^4.0.2",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@vitest/coverage-v8": "^1.2.1",
"@vitest/eslint-plugin": "^1.1.25",
"console-fail-test": "^0.5.0",
"cspell": "^8.3.2",
"eslint": "^8.56.0",
"eslint-doc-generator": "^2.0.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint": "^9.18.0",
"eslint-doc-generator": "^2.0.2",
"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",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-perfectionist": "^2.5.0",
"eslint-plugin-regexp": "^2.2.0",
"eslint-plugin-vitest": "^0.4.0",
"eslint-plugin-yml": "^1.12.2",
"eslint-plugin-jsdoc": "^50.6.1",
"eslint-plugin-jsonc": "^2.18.2",
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-n": "^17.15.1",
"eslint-plugin-perfectionist": "^4.6.0",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-yml": "^1.16.0",
"husky": "^9.0.0",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.0.0",
"lint-staged": "^15.2.0",
"markdownlint": "^0.37.0",
"lint-staged": "^15.3.0",
"markdownlint": "^0.37.4",
"markdownlint-cli": "^0.43.0",
"npm-package-json-lint": "^8.0.0",
"npm-package-json-lint-config-default": "^7.0.0",
"prettier": "^3.2.4",
"prettier-plugin-curly": "^0.3.0",
"prettier-plugin-packagejson": "^2.4.9",
"release-it": "^18.0.0",
"should-semantic-release": "^0.3.0",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vitest": "^1.2.1",
"yaml-eslint-parser": "^1.2.2"
"typescript": "^5.7.3",
"typescript-eslint": "^8.20.0",
"vitest": "^1.2.1"
},
"peerDependencies": {
"eslint": ">=8.0.0",
Expand Down
Loading

0 comments on commit f37aa93

Please sign in to comment.