Skip to content

Commit c741d7e

Browse files
authored
Merge pull request #17 from alexrecuenco/upgrade-to-eslint9
Upgrade to eslint9
2 parents 449f2ed + b16c9ee commit c741d7e

File tree

9 files changed

+1263
-1052
lines changed

9 files changed

+1263
-1052
lines changed

.eslintignore

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

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ coverage/
1313
report/
1414
!*.js
1515
!*.ts
16+
!*.mjs
17+
!*.cjs
18+
!*.mts
19+
!*.cts
1620
!.vscode/*.json

.vscode/extensions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@
66
"visualstudioexptteam.vscodeintellicode",
77
"pmneo.tsimporter",
88
"orta.vscode-jest",
9+
"meganrogge.template-string-converter",
10+
"simonsiefke.svg-preview",
11+
"yoavbls.pretty-ts-errors",
12+
"csstools.postcss",
913
],
1014
}

eslint.config.js renamed to eslint.config.mjs

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const js = require('@eslint/js');
2-
const tseslint = require('typescript-eslint');
3-
const eslintConfigPrettier = require('eslint-config-prettier');
4-
const tsParser = require('@typescript-eslint/parser');
1+
import js from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
import eslintConfigPrettier from 'eslint-config-prettier';
4+
import tsParser from '@typescript-eslint/parser';
55
// When it works again do `npm install --save-dev eslint-plugin-import`
6-
// const imprt = require('eslint-plugin-import');
6+
// import imprt from 'eslint-plugin-import';
77
// https://github.com/eslint/eslint/issues/18087
88
// https://github.com/import-js/eslint-plugin-import/pull/2829
9-
const globals = require('globals');
10-
const jest = require('eslint-plugin-jest');
9+
import globals from 'globals';
10+
import jest from 'eslint-plugin-jest';
1111

1212
const off = 'off';
1313
const warn = 'warn';
@@ -32,8 +32,33 @@ const any_rules = (level) => {
3232
'@typescript-eslint/no-explicit-any': level,
3333
};
3434
};
35-
36-
module.exports = [
35+
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray} */
36+
export default [
37+
{
38+
ignores: [
39+
'lib/',
40+
'build/',
41+
'build-*/',
42+
'dist/',
43+
'.vscode/',
44+
'node_modules/',
45+
'coverage/',
46+
'report/',
47+
'!*.js',
48+
'!*.mjs',
49+
'!*.cjs',
50+
'!*.ts',
51+
'!.vscode/*.json',
52+
'package-lock.json',
53+
'**/node_modules',
54+
'**/dist',
55+
'**/build',
56+
'**/__snapshots__',
57+
'**/mocks',
58+
'**/coverage',
59+
'**/report',
60+
],
61+
},
3762
js.configs.recommended,
3863
tseslint.configs.eslintRecommended,
3964
...tseslint.configs.recommended,
@@ -45,26 +70,15 @@ module.exports = [
4570
parserOptions: {
4671
ecmaVersion: 2022,
4772
sourceType: 'module',
48-
tsconfigRootDir: __dirname,
73+
tsconfigRootDir: import.meta.dirname,
4974
project: [
5075
'./tsconfig.eslint.json',
5176
'./tsconfig.json',
52-
'/tsconfig.prod.json',
77+
'./tsconfig.prod.json',
5378
],
5479
},
5580
},
5681
},
57-
{
58-
ignores: [
59-
'**/node_modules',
60-
'**/dist',
61-
'**/build',
62-
'**/__snapshots__',
63-
'**/mocks',
64-
'**/coverage',
65-
'**/report',
66-
],
67-
},
6882
// Disables all styling from eslint
6983
eslintConfigPrettier,
7084
{
@@ -119,14 +133,24 @@ module.exports = [
119133
},
120134
},
121135
{
122-
files: ['.*.js', '.*.cjs', '*.config.cjs', '*.config.js', '*.config.ts'],
136+
name: 'linting for configuration files',
137+
files: [
138+
'.*.js',
139+
'.*.mjs',
140+
'.*.cjs',
141+
'*.config.mjs',
142+
'*.config.cjs',
143+
'*.config.js',
144+
'*.config.ts',
145+
],
123146
rules: {
124147
'no-restricted-imports': off,
125148
// Consider if this is too leanient for tests
126149
...any_rules('off'),
127150
},
128151
},
129152
{
153+
name: 'Rules for tests with jest',
130154
files: [
131155
'**/*.test.js',
132156
'**/*.spec.js',

0 commit comments

Comments
 (0)