Skip to content

Commit 9292ce2

Browse files
committed
Eslint 9 upgrade (#572)
* Updated to eslint 9+ * Removed linting from /examples (linted from the project root) * Exclude eslint.config.mjs for SonarQube
1 parent a23dcde commit 9292ce2

72 files changed

Lines changed: 3326 additions & 21698 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

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

.eslintrc.js

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

.github/workflows/tests.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3535

36-
examples:
37-
name: Lint Examples
36+
lint:
37+
name: Lint
3838
runs-on: ubuntu-latest
3939
if: >
4040
github.event_name == 'push' ||
@@ -45,7 +45,7 @@ jobs:
4545

4646
- uses: actions/setup-node@v4
4747
with:
48-
node-version: '16'
48+
node-version: '20'
4949

5050
- run: npm install --ignore-scripts
5151

@@ -54,15 +54,22 @@ jobs:
5454
- name: print versions
5555
run: echo npm $(npm -v), node $(node -v)
5656

57-
- run: pushd ./examples/aml-check && npm install --ignore-scripts && npm update && npm run lint && popd
57+
- run: npm install --ignore-scripts -p ./examples/aml-check
58+
- run: npm install --ignore-scripts -p ./examples/digital-identity
59+
- run: npm install --ignore-scripts -p ./examples/idv
60+
- run: npm install --ignore-scripts -p ./examples/idv-identity-checks
61+
- run: npm install --ignore-scripts -p ./examples/profile
62+
- run: npm install --ignore-scripts -p ./examples/profile-identity-checks
5863

59-
- run: pushd ./examples/idv && npm install --ignore-scripts && npm update && npm run lint && popd
64+
- run: npm run lint
6065

61-
- run: pushd ./examples/idv-identity-checks && npm install --ignore-scripts && npm update && npm run lint && popd
62-
63-
- run: pushd ./examples/profile && npm install --ignore-scripts && npm update && npm run lint && popd
64-
65-
- run: pushd ./examples/profile-identity-checks && npm install --ignore-scripts && npm update && npm run lint && popd
66+
# - run: pushd ./examples/idv && npm install --ignore-scripts && npm update && npm run lint && popd
67+
#
68+
# - run: pushd ./examples/idv-identity-checks && npm install --ignore-scripts && npm update && npm run lint && popd
69+
#
70+
# - run: pushd ./examples/profile && npm install --ignore-scripts && npm update && npm run lint && popd
71+
#
72+
# - run: pushd ./examples/profile-identity-checks && npm install --ignore-scripts && npm update && npm run lint && popd
6673

6774
node-compatibility:
6875
name: Node ${{ matrix.node-version }}
@@ -89,7 +96,7 @@ jobs:
8996
- run: npm update
9097

9198
# Jest 30 does not support Node 14/16
92-
- run: npm install jest@29
99+
- run: npm install --ignore-scripts jest@29
93100

94101
- run: npm run test
95102

audit-ci.jsonc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"moderate": true,
33
"skip-dev": false,
4-
"allowlist": [
5-
"GHSA-p5wg-g6qr-c7cg|eslint",
6-
"GHSA-p5wg-g6qr-c7cg|eslint-config-airbnb-base>eslint"
7-
]
4+
"allowlist": []
85
}

eslint.config.mjs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import path from 'path';
2+
3+
import { includeIgnoreFile } from '@eslint/compat';
4+
import js from '@eslint/js';
5+
import { defineConfig } from 'eslint/config';
6+
import { configs, plugins } from 'eslint-config-airbnb-extended';
7+
import pluginJest from 'eslint-plugin-jest';
8+
9+
const gitignorePath = path.resolve('.', '.gitignore');
10+
const gitIgnored = includeIgnoreFile(gitignorePath);
11+
12+
const jsConfig = defineConfig([
13+
// ESLint recommended config
14+
{
15+
name: 'js/config',
16+
...js.configs.recommended,
17+
},
18+
// Stylistic plugin
19+
plugins.stylistic,
20+
// Import X plugin
21+
plugins.importX,
22+
// Airbnb base recommended config
23+
...configs.base.recommended,
24+
]);
25+
26+
const nodeConfig = defineConfig([
27+
// Node plugin
28+
plugins.node,
29+
// Airbnb Node recommended config
30+
...configs.node.recommended,
31+
]);
32+
33+
const fullConfig = defineConfig([
34+
{
35+
ignores: [...gitIgnored.ignores, 'types'],
36+
},
37+
// JavaScript config
38+
...jsConfig,
39+
// Node config
40+
...nodeConfig,
41+
{
42+
files: ['**/*.spec.js'],
43+
plugins: { jest: pluginJest },
44+
languageOptions: {
45+
globals: pluginJest.environments.globals.globals,
46+
},
47+
rules: {
48+
'jest/no-disabled-tests': 'warn',
49+
'jest/no-focused-tests': 'error',
50+
'jest/no-identical-title': 'error',
51+
'jest/prefer-to-have-length': 'warn',
52+
'jest/valid-expect': 'error',
53+
},
54+
},
55+
{
56+
rules: {
57+
'n/no-sync': 'off',
58+
strict: 'off',
59+
'default-param-last': 'off',
60+
'prefer-object-spread': 'off',
61+
'@stylistic/comma-dangle': ['error', {
62+
arrays: 'always-multiline',
63+
exports: 'always-multiline',
64+
functions: 'never',
65+
imports: 'always-multiline',
66+
objects: 'always-multiline',
67+
}],
68+
'@stylistic/max-len': ['error', {
69+
code: 160,
70+
tabWidth: 2,
71+
ignoreUrls: true,
72+
ignoreComments: false,
73+
ignoreRegExpLiterals: true,
74+
ignoreStrings: true,
75+
ignoreTemplateLiterals: true,
76+
ignorePattern: '\\* @typedef \\{import',
77+
}],
78+
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
79+
},
80+
},
81+
]);
82+
83+
export default fullConfig;

examples/aml-check/.eslintrc.js

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

0 commit comments

Comments
 (0)