Skip to content

Commit eec9d95

Browse files
committed
feat: support ESLint 9
Also: - test: switch to flat config
1 parent 5c4ccb9 commit eec9d95

39 files changed

+1625
-1144
lines changed

.eslintrc.json

-46
This file was deleted.

.github/workflows/feature.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
with:
1616
node-version: '20'
1717
- run: pnpm install
18+
- run: pnpm build
1819
- run: pnpm lint
1920
timeout-minutes: 10
2021
test:
@@ -39,7 +40,6 @@ jobs:
3940
fail-fast: false
4041
matrix:
4142
node_js_version:
42-
- '16'
4343
- '18'
4444
- '20'
4545
build:

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Tests are expected. Each rule file should be in CamelCase (despite the rule name
5454

5555
Each rule file should be an ESM default export of an object that has `valid` and `invalid` array properties containing the tests. Tests of each type should be provided.
5656

57-
`parserOptions` will be `ecmaVersion: 6` by default, but tests can override `parserOptions`
57+
`languageOptions` will be `ecmaVersion: 6` by default, but tests can override `languageOptions`
5858
with their own.
5959

6060
See ESLint's [RuleTester](https://eslint.org/docs/developer-guide/nodejs-api#ruletester)

eslint.config.mjs

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import globals from 'globals';
2+
import jsdoc from './dist/index.js';
3+
// import canonical from 'eslint-config-canonical';
4+
// import canonicalJsdoc from 'eslint-config-canonical/jsdoc.js';
5+
6+
const common = {
7+
linterOptions: {
8+
reportUnusedDisableDirectives: 0
9+
},
10+
plugins: {
11+
jsdoc
12+
}
13+
};
14+
15+
export default [
16+
// canonical,
17+
// canonicalJsdoc,
18+
{
19+
...common,
20+
files: ['.ncurc.js'],
21+
languageOptions: {
22+
parserOptions: {
23+
ecmaFeatures: {
24+
impliedStrict: false
25+
},
26+
},
27+
sourceType: 'script'
28+
},
29+
rules: {
30+
'import/no-commonjs': 0,
31+
strict: [
32+
'error',
33+
'global'
34+
]
35+
}
36+
},
37+
{
38+
...common,
39+
files: ['test/**/*.js'],
40+
rules: {
41+
'no-restricted-syntax': 0,
42+
'unicorn/prevent-abbreviations': 0
43+
}
44+
},
45+
{
46+
...common,
47+
ignores: ['dist/**/*.js', '.ignore/**/*.js'],
48+
languageOptions: {
49+
globals: globals.node
50+
},
51+
settings: {
52+
jsdoc: {
53+
mode: 'typescript'
54+
}
55+
},
56+
rules: {
57+
'array-element-newline': 0,
58+
'filenames/match-regex': 0,
59+
'import/extensions': 0,
60+
'import/no-useless-path-segments': 0,
61+
'prefer-named-capture-group': 0,
62+
'unicorn/no-array-reduce': 0,
63+
'unicorn/no-unsafe-regex': 0,
64+
'unicorn/prefer-array-some': 0,
65+
'unicorn/prevent-abbreviations': 0,
66+
'unicorn/import-index': 0,
67+
'linebreak-style': 0,
68+
'no-inline-comments': 0,
69+
'no-extra-parens': 0
70+
}
71+
}
72+
];

package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"description": "JSDoc linting rules for ESLint.",
1919
"devDependencies": {
2020
"@babel/cli": "^7.23.4",
21-
"@babel/core": "^7.23.6",
21+
"@babel/core": "^7.23.7",
2222
"@babel/eslint-parser": "^7.23.3",
2323
"@babel/node": "^7.22.19",
2424
"@babel/plugin-syntax-class-properties": "^7.12.13",
2525
"@babel/plugin-transform-flow-strip-types": "^7.23.3",
26-
"@babel/preset-env": "^7.23.6",
27-
"@babel/register": "^7.22.15",
26+
"@babel/preset-env": "^7.23.7",
27+
"@babel/register": "^7.23.7",
2828
"@es-joy/escodegen": "^3.5.1",
29-
"@es-joy/jsdoc-eslint-parser": "^0.21.0",
29+
"@es-joy/jsdoc-eslint-parser": "^0.21.1",
3030
"@hkdobrev/run-if-changed": "^0.3.1",
3131
"@semantic-release/commit-analyzer": "^11.1.0",
3232
"@semantic-release/github": "^9.2.6",
@@ -39,7 +39,7 @@
3939
"@types/json-schema": "^7.0.15",
4040
"@types/lodash.defaultsdeep": "^4.6.9",
4141
"@types/mocha": "^10.0.6",
42-
"@types/node": "^20.10.5",
42+
"@types/node": "^20.10.6",
4343
"@types/semver": "^7.5.6",
4444
"@types/spdx-expression-parse": "^3.0.5",
4545
"@typescript-eslint/parser": "^6.16.0",
@@ -49,11 +49,12 @@
4949
"chai": "^4.3.10",
5050
"cross-env": "^7.0.3",
5151
"decamelize": "^5.0.1",
52-
"eslint": "8.56.0",
52+
"eslint": "9.0.0-alpha.0",
5353
"eslint-config-canonical": "~42.8.0",
5454
"espree": "^9.6.1",
5555
"gitdown": "^3.1.5",
5656
"glob": "^10.3.10",
57+
"globals": "^13.24.0",
5758
"husky": "^8.0.3",
5859
"jsdoc-type-pratt-parser": "^4.0.0",
5960
"json-schema": "^0.4.0",
@@ -67,7 +68,7 @@
6768
"typescript": "5.3.3"
6869
},
6970
"engines": {
70-
"node": ">=16"
71+
"node": ">=18"
7172
},
7273
"keywords": [
7374
"eslint",
@@ -113,7 +114,7 @@
113114
"statements": 100
114115
},
115116
"peerDependencies": {
116-
"eslint": "^7.0.0 || ^8.0.0"
117+
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0"
117118
},
118119
"repository": {
119120
"type": "git",
@@ -132,7 +133,7 @@
132133
"create-options": "node ./src/bin/generateOptions.mjs",
133134
"install-offline": "pnpm install --prefer-offline --no-audit",
134135
"lint": "npm run lint-arg -- .",
135-
"lint-arg": "eslint --report-unused-disable-directives",
136+
"lint-arg": "eslint --report-unused-disable-directives=false",
136137
"lint-fix": "npm run lint-arg -- --fix .",
137138
"prepare": "husky install",
138139
"test-no-cov": "cross-env BABEL_ENV=test mocha",

0 commit comments

Comments
 (0)