Skip to content

Commit

Permalink
feat: support ESLint 9
Browse files Browse the repository at this point in the history
Also:
- test: switch to flat config
  • Loading branch information
brettz9 committed Dec 30, 2023
1 parent 5c4ccb9 commit eec9d95
Show file tree
Hide file tree
Showing 39 changed files with 1,625 additions and 1,144 deletions.
46 changes: 0 additions & 46 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
with:
node-version: '20'
- run: pnpm install
- run: pnpm build
- run: pnpm lint
timeout-minutes: 10
test:
Expand All @@ -39,7 +40,6 @@ jobs:
fail-fast: false
matrix:
node_js_version:
- '16'
- '18'
- '20'
build:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Tests are expected. Each rule file should be in CamelCase (despite the rule name

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.

`parserOptions` will be `ecmaVersion: 6` by default, but tests can override `parserOptions`
`languageOptions` will be `ecmaVersion: 6` by default, but tests can override `languageOptions`
with their own.

See ESLint's [RuleTester](https://eslint.org/docs/developer-guide/nodejs-api#ruletester)
Expand Down
72 changes: 72 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import globals from 'globals';
import jsdoc from './dist/index.js';
// import canonical from 'eslint-config-canonical';
// import canonicalJsdoc from 'eslint-config-canonical/jsdoc.js';

const common = {
linterOptions: {
reportUnusedDisableDirectives: 0
},
plugins: {
jsdoc
}
};

export default [
// canonical,
// canonicalJsdoc,
{
...common,
files: ['.ncurc.js'],
languageOptions: {
parserOptions: {
ecmaFeatures: {
impliedStrict: false
},
},
sourceType: 'script'
},
rules: {
'import/no-commonjs': 0,
strict: [
'error',
'global'
]
}
},
{
...common,
files: ['test/**/*.js'],
rules: {
'no-restricted-syntax': 0,
'unicorn/prevent-abbreviations': 0
}
},
{
...common,
ignores: ['dist/**/*.js', '.ignore/**/*.js'],
languageOptions: {
globals: globals.node
},
settings: {
jsdoc: {
mode: 'typescript'
}
},
rules: {
'array-element-newline': 0,
'filenames/match-regex': 0,
'import/extensions': 0,
'import/no-useless-path-segments': 0,
'prefer-named-capture-group': 0,
'unicorn/no-array-reduce': 0,
'unicorn/no-unsafe-regex': 0,
'unicorn/prefer-array-some': 0,
'unicorn/prevent-abbreviations': 0,
'unicorn/import-index': 0,
'linebreak-style': 0,
'no-inline-comments': 0,
'no-extra-parens': 0
}
}
];
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"description": "JSDoc linting rules for ESLint.",
"devDependencies": {
"@babel/cli": "^7.23.4",
"@babel/core": "^7.23.6",
"@babel/core": "^7.23.7",
"@babel/eslint-parser": "^7.23.3",
"@babel/node": "^7.22.19",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-transform-flow-strip-types": "^7.23.3",
"@babel/preset-env": "^7.23.6",
"@babel/register": "^7.22.15",
"@babel/preset-env": "^7.23.7",
"@babel/register": "^7.23.7",
"@es-joy/escodegen": "^3.5.1",
"@es-joy/jsdoc-eslint-parser": "^0.21.0",
"@es-joy/jsdoc-eslint-parser": "^0.21.1",
"@hkdobrev/run-if-changed": "^0.3.1",
"@semantic-release/commit-analyzer": "^11.1.0",
"@semantic-release/github": "^9.2.6",
Expand All @@ -39,7 +39,7 @@
"@types/json-schema": "^7.0.15",
"@types/lodash.defaultsdeep": "^4.6.9",
"@types/mocha": "^10.0.6",
"@types/node": "^20.10.5",
"@types/node": "^20.10.6",
"@types/semver": "^7.5.6",
"@types/spdx-expression-parse": "^3.0.5",
"@typescript-eslint/parser": "^6.16.0",
Expand All @@ -49,11 +49,12 @@
"chai": "^4.3.10",
"cross-env": "^7.0.3",
"decamelize": "^5.0.1",
"eslint": "8.56.0",
"eslint": "9.0.0-alpha.0",
"eslint-config-canonical": "~42.8.0",
"espree": "^9.6.1",
"gitdown": "^3.1.5",
"glob": "^10.3.10",
"globals": "^13.24.0",
"husky": "^8.0.3",
"jsdoc-type-pratt-parser": "^4.0.0",
"json-schema": "^0.4.0",
Expand All @@ -67,7 +68,7 @@
"typescript": "5.3.3"
},
"engines": {
"node": ">=16"
"node": ">=18"
},
"keywords": [
"eslint",
Expand Down Expand Up @@ -113,7 +114,7 @@
"statements": 100
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0"
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0"
},
"repository": {
"type": "git",
Expand All @@ -132,7 +133,7 @@
"create-options": "node ./src/bin/generateOptions.mjs",
"install-offline": "pnpm install --prefer-offline --no-audit",
"lint": "npm run lint-arg -- .",
"lint-arg": "eslint --report-unused-disable-directives",
"lint-arg": "eslint --report-unused-disable-directives=false",
"lint-fix": "npm run lint-arg -- --fix .",
"prepare": "husky install",
"test-no-cov": "cross-env BABEL_ENV=test mocha",
Expand Down
Loading

0 comments on commit eec9d95

Please sign in to comment.