Skip to content

Commit b52cb96

Browse files
committed
Use ESLint v9.
- Update dependencies. - `eslint@9` and related packages. - Rework all configs to new eslint style.
1 parent cdbe845 commit b52cb96

File tree

20 files changed

+364
-256
lines changed

20 files changed

+364
-256
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# https://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{cjs,js,json,jsonld,mjs,yaml,yml}]
12+
indent_style = space
13+
indent_size = 2

.eslintrc.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/main.yml renamed to .github/workflows/main.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint CI
1+
name: Main CI
22

33
on: [push]
44

@@ -8,11 +8,11 @@ jobs:
88
timeout-minutes: 10
99
strategy:
1010
matrix:
11-
node-version: [14.x]
11+
node-version: [24.x]
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- name: Use Node.js ${{ matrix.node-version }}
15-
uses: actions/setup-node@v1
15+
uses: actions/setup-node@v4
1616
with:
1717
node-version: ${{ matrix.node-version }}
1818
- run: npm install

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# eslint-config-digitalbazaar ChangeLog
22

3+
### 6.0.0 - 2025-08-xx
4+
5+
### Changed
6+
- **BREAKING**: Update to `eslint@9`.
7+
- Please see the migration notes below.
8+
- Comments and suggestions welcome for how best to adapt to the rules that
9+
were changed, added, or removed between v8 and v9.
10+
- The way configuration is done change significantly. Suggestions welcome on
11+
how best to adapt to the new style.
12+
13+
### Migration
14+
- ESLint v9 is a major breaking change and will require manual updates.
15+
- ESLint has a migration guide:
16+
- https://eslint.org/docs/latest/use/configure/migration-guide
17+
- A few major notes:
18+
- The configuration file changes from multiple `.eslintrc.cjs` or similar to
19+
a single top level `eslint.config.js`.
20+
- Invocation is now `eslint` without options.
21+
- Style rules were deprecated and moved to the stylistic project.
22+
- The Digital Bazaar rules are mostly the same as before with updates to
23+
`@stylistic/RULENAME` as needed.
24+
- Note the common `max-len` is now `@stylistic/max-len`.
25+
- Unused rules are now flagged which should help with migration to new rules,
26+
or elimination of unused rules.
27+
- Quasar has not yet updated support for v9. Until that is updated, stay with
28+
v8, or update to v9 and drop Quasar linting and only use Vue linting.
29+
- Major types of rules are grouped together.
30+
- The groups can be composed together as needed.
31+
- There are opinionated configs that compose a number of rules and apply to
32+
many common Digital Bazaar repositories.
33+
- See the [README](./README.md) for notes and usage examples.
34+
335
### 5.2.0 - 2024-05-02
436

537
### Changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ There are 6 rule sets:
1010
5. `eslint-config-digitalbazaar/vue`: Rules for Vue 2 projects and browser only.
1111
6. `eslint-config-digitalbazaar/vue3`: Rules for Vue 3 projects and browser only.
1212

13-
1413
## Installation
1514

1615
If you do not have eslint installed:
@@ -25,17 +24,17 @@ npx eslint --init
2524
```
2625
or rename a template from the templates dir
2726
```
28-
cp node_modules/eslint-config-digitalbazaar/templates/node.js ./.eslintrc.cjs
27+
cp node_modules/eslint-config-digitalbazaar/templates/node.js ./eslint.config.js
2928
```
3029

3130
## Usage
3231

3332
All rules can be accessed via the shorthand `digitalbazaar`
3433
or using the full module name `eslint-config-digitalbazaar`.
3534

36-
Eslint's documentation on [shareable configs](https://eslint.org/docs/developer-guide/shareable-configs) can be found here.
35+
ESLint's documentation on [shareable configs](https://eslint.org/docs/developer-guide/shareable-configs) can be found here.
3736

38-
Example .eslintrc.cjs root setup:
37+
Example `eslint.config.js` root setup:
3938
```js
4039
module.exports = {
4140
root: true,
@@ -52,7 +51,7 @@ To use the import rules you need to install [`eslint-plugin-import`](https://git
5251
npm i -D eslint-plugin-import
5352
```
5453

55-
Example .eslintrc.cjs import setup:
54+
Example `eslint.config.js` import setup:
5655
```js
5756
module.exports = {
5857
extends: ['digitalbazaar/import']
@@ -66,7 +65,7 @@ To use the JSDoc rules you will need to install [`eslint-plugin-jsdoc`](https://
6665
npm i -D eslint-plugin-jsdoc
6766
```
6867

69-
Example .eslintrc.cjs JSDoc setup:
68+
Example `eslint.config.js` JSDoc setup:
7069
```js
7170
module.exports = {
7271
// only the JSDoc rules and any rules in parent dirs
@@ -81,7 +80,7 @@ To use ES module code rather than CommonJS, you will need to install [`eslint-pl
8180
npm i -D eslint-plugin-unicorn
8281
```
8382

84-
Example .eslintrc.cjs ESM setup:
83+
Example `eslint.config.js` ESM setup:
8584
```js
8685
module.exports = {
8786
// only the module rules and any rules in parent dirs
@@ -96,7 +95,7 @@ To use the Vue 2 rules you will need to install [`eslint-plugin-vue`](https://es
9695
npm i -D eslint-plugin-vue
9796
```
9897

99-
Example .eslintrc.cjs Vue setup:
98+
Example `eslint.config.js` Vue setup:
10099
```js
101100
module.exports = {
102101
// only the vue rules and any rules in parent dirs
@@ -114,7 +113,7 @@ To use the Vue 3 rules you will need to install [`eslint-plugin-vue`](https://es
114113
npm i -D eslint-plugin-vue
115114
```
116115

117-
Example .eslintrc.cjs Vue setup:
116+
Example `eslint.config.js` Vue setup:
118117
```js
119118
module.exports = {
120119
// only the vue3 rules and any rules in parent dirs

eslint.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import digitalbazaar from './index.js';
2+
import digitalbazaarImport from './import.js';
3+
import globals from 'globals';
4+
5+
export default [
6+
...digitalbazaar,
7+
{
8+
files: ['**/*.js'],
9+
languageOptions: {
10+
globals: {
11+
...globals.node
12+
}
13+
},
14+
},
15+
{
16+
...digitalbazaarImport,
17+
files: ['test/import/*.js']
18+
}
19+
];

import.js

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
1-
module.exports = {
2-
env: {
3-
es2020: true
4-
},
5-
parserOptions: {
6-
sourceType: 'module'
7-
},
8-
plugins: [
9-
// https://github.com/import-js/eslint-plugin-import
10-
'import'
11-
],
12-
rules: {
13-
// Verifies that all named imports are part of the set of named
14-
// exports in the imported module.
15-
'import/named': 'error',
16-
// If a default import is requested, this rule will report if
17-
// there is no default export in the imported module.
18-
'import/default': 'error',
19-
// throws if a namespace like `import * as all` is used and
20-
// `all.foo` is not exported
21-
'import/namespace': 'error',
22-
// throws if a module imports itself
23-
'import/no-self-import': 'error',
24-
// Reports funny business with exports, like repeated exports
25-
// of names or defaults.
26-
'import/export': 'error',
27-
// warns if an imported member if marked @deprecated
28-
'import/no-deprecated': 'error',
29-
// warns if a dep is not in the package.json
30-
'import/no-extraneous-dependencies': 'error',
31-
// disallows exporting members with let & var
32-
// throw if you import something more than once in a file/module
33-
'import/no-duplicates': 'error'
1+
import eslintPluginImport from 'eslint-plugin-import';
2+
3+
export default [
4+
{
5+
languageOptions: {
6+
ecmaVersion: 2020,
7+
sourceType: 'module'
8+
},
9+
plugins: {
10+
// https://github.com/import-js/eslint-plugin-import
11+
import: eslintPluginImport
12+
},
13+
rules: {
14+
// Verifies that all named imports are part of the set of named
15+
// exports in the imported module.
16+
'import/named': 'error',
17+
// If a default import is requested, this rule will report if
18+
// there is no default export in the imported module.
19+
'import/default': 'error',
20+
// throws if a namespace like `import * as all` is used and
21+
// `all.foo` is not exported
22+
'import/namespace': 'error',
23+
// throws if a module imports itself
24+
'import/no-self-import': 'error',
25+
// Reports funny business with exports, like repeated exports
26+
// of names or defaults.
27+
'import/export': 'error',
28+
// warns if an imported member if marked @deprecated
29+
'import/no-deprecated': 'error',
30+
// warns if a dep is not in the package.json
31+
'import/no-extraneous-dependencies': 'error',
32+
// disallows exporting members with let & var
33+
// throw if you import something more than once in a file/module
34+
'import/no-duplicates': 'error'
35+
}
3436
}
35-
};
37+
];

0 commit comments

Comments
 (0)