Skip to content

Commit 1d226f2

Browse files
chore: bumped ESLint and Prettier devDeps to latest (flat config) (#271)
* chore: bumped ESLint and Prettier devDeps to latest (flat config) * split lint into separate task * fix typo: npm 'run' lint * No more ||= (logical-assignment-operators)
1 parent e39e025 commit 1d226f2

File tree

6 files changed

+1603
-678
lines changed

6 files changed

+1603
-678
lines changed

.eslintignore

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

.github/workflows/build.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ permissions:
88
contents: read
99

1010
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
14+
name: node lint
15+
16+
steps:
17+
- name: checkout
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
20+
- name: setup node 22
21+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
22+
with:
23+
node-version: 22
24+
25+
- name: npm ci
26+
run: npm ci
27+
28+
- run: npm run lint
29+
1130
test:
1231
runs-on: ubuntu-latest
1332

@@ -16,7 +35,7 @@ jobs:
1635
matrix:
1736
node-version: [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 ]
1837

19-
name: node v${{ matrix.node-version }} build
38+
name: node v${{ matrix.node-version }} test
2039

2140
steps:
2241
- name: checkout

app/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = class extends Generator {
4040
message: 'Your generator name',
4141
default: makeGeneratorName(path.basename(process.cwd())),
4242
filter: makeGeneratorName,
43-
validate: str => {
43+
validate(str) {
4444
return str.length > 'generator-'.length;
4545
}
4646
},

eslint.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const { defineConfig } = require('eslint/config');
2+
const xo = require('eslint-config-xo');
3+
const configPrettier = require('eslint-config-prettier/flat');
4+
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
5+
const globals = require('globals');
6+
7+
module.exports = defineConfig([
8+
{ ignores: ['app/templates', 'coverage', 'node_modules'] },
9+
{ rules: xo.rules },
10+
configPrettier,
11+
eslintPluginPrettierRecommended,
12+
{
13+
languageOptions: {
14+
globals: {
15+
...globals.jest,
16+
...globals.node
17+
}
18+
},
19+
linterOptions: {
20+
reportUnusedDisableDirectives: 'error'
21+
},
22+
rules: {
23+
// Only supported in Node >=15; we still support >=10 for now
24+
'logical-assignment-operators': 'off',
25+
26+
'prettier/prettier': [
27+
'error',
28+
{
29+
arrowParens: 'avoid',
30+
printWidth: 90,
31+
singleQuote: true,
32+
trailingComma: 'none'
33+
}
34+
]
35+
}
36+
}
37+
]);

0 commit comments

Comments
 (0)