Skip to content

Commit 4e85485

Browse files
authored
Merge pull request #516 from OpenConext/fix/eslint-9-flat-config
Upgrade to ESLint 9 with flat config to fix release build
2 parents c7be898 + 1b32342 commit 4e85485

7 files changed

Lines changed: 374 additions & 1187 deletions

File tree

.github/workflows/test-integration.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ jobs:
2929

3030
- name: Run QA tests
3131
run: composer check-ci
32+
33+
- name: Build frontend assets
34+
run: yarn encore production

assets/typescript/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import jQuery from 'jquery';
2-
(window as any).jQuery = jQuery;
2+
(window as unknown as { jQuery: typeof jQuery }).jQuery = jQuery;
33
import 'bootstrap';

assets/typescript/registration-print.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import jQuery from 'jquery';
1515
* limitations under the License.
1616
*/
1717

18-
document.addEventListener('DOMContentLoaded', (_) => {
18+
document.addEventListener('DOMContentLoaded', () => {
1919
jQuery('a.registration-print').on('click', (e) => {
2020
e.preventDefault();
2121

eslint.config.mjs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import js from '@eslint/js';
2+
import typescriptEslint from 'typescript-eslint';
3+
4+
export default [
5+
{
6+
ignores: [
7+
'vendor/**',
8+
'node_modules/**',
9+
'var/**',
10+
'public/build/**',
11+
'build/**',
12+
'dist/**',
13+
],
14+
},
15+
js.configs.recommended,
16+
...typescriptEslint.configs.recommendedTypeChecked,
17+
{
18+
files: ['**/*.ts', '**/*.tsx'],
19+
languageOptions: {
20+
parserOptions: {
21+
project: './tsconfig.json',
22+
tsconfigRootDir: import.meta.dirname,
23+
},
24+
},
25+
rules: {
26+
'@typescript-eslint/no-explicit-any': 'warn',
27+
'@typescript-eslint/no-unused-vars': 'warn',
28+
},
29+
},
30+
{
31+
// Disable type-checking rules for JS files
32+
files: ['**/*.js', '**/*.jsx'],
33+
...typescriptEslint.configs.disableTypeChecked,
34+
},
35+
];

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"devDependencies": {
44
"@babel/core": "^7.29.7",
55
"@babel/preset-env": "^7.29.7",
6+
"@eslint/js": "^9.39.4",
67
"@symfony/webpack-encore": "^5.0.0",
78
"@types/jest": "^30",
89
"@types/jquery": "^3.5.32",
910
"@types/node": "^20",
1011
"compass-mixins": "^0.12.10",
1112
"css-loader": "^7.1.4",
12-
"eslint": "^8.57.0",
13-
"eslint-config-airbnb": "^19.0",
14-
"eslint-plugin-import": "^2.31.0",
13+
"eslint": "^9.39.4",
1514
"eslint-webpack-plugin": "^5.0.3",
15+
"typescript-eslint": "^8.59.3",
1616
"file-loader": "^6.0.0",
1717
"jest": "^30",
1818
"less": "^4.6.4",

webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ Encore
3737
})
3838
.addLoader({test: /\.scss$/, loader: 'webpack-import-glob-loader', enforce: 'pre'})
3939
.addPlugin(new ESLintPlugin({
40-
extensions: ['js', 'jsx', 'ts', 'tsx', 'vue'],
40+
extensions: ['ts', 'js'],
41+
files: 'assets/typescript',
42+
emitWarning: true,
43+
failOnError: Encore.isProduction(),
4144
}))
4245
.enableSingleRuntimeChunk()
4346
.enableSourceMaps(!Encore.isProduction())

0 commit comments

Comments
 (0)