Skip to content

Commit eccf573

Browse files
mariedmsimaoseica-dd
authored andcommitted
Migrate to new flat configuration system
1 parent 53d646d commit eccf573

File tree

5 files changed

+1360
-1510
lines changed

5 files changed

+1360
-1510
lines changed

.prettierrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ semi: false
55
singleQuote: true
66
tabWidth: 2
77
trailingComma: 'es5'
8+
importModuleSpecifierEnding: 'js'
Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,53 @@
1-
{
2-
"plugins": ["jest", "@typescript-eslint"],
3-
"extends": ["plugin:github/recommended"],
4-
"parser": "@typescript-eslint/parser",
5-
"parserOptions": {
6-
"ecmaVersion": 9,
7-
"sourceType": "module",
8-
"project": "./tsconfig.json"
1+
import github from 'eslint-plugin-github';
2+
import jestPlugin from 'eslint-plugin-jest';
3+
import * as tseslint from 'typescript-eslint';
4+
import globals from 'globals';
5+
6+
export default [
7+
// Base configurations
8+
...tseslint.configs.recommended,
9+
...tseslint.configs.stylistic,
10+
11+
// GitHub plugin configurations
12+
github.getFlatConfigs().recommended,
13+
14+
// TypeScript-specific linting configuration
15+
{
16+
files: ['**/*.ts'],
17+
languageOptions: {
18+
parser: tseslint.parser,
19+
parserOptions: {
20+
ecmaVersion: 2020,
21+
sourceType: 'module',
22+
project: './tsconfig.json'
23+
},
24+
globals: {
25+
...globals.node,
26+
...globals.es2015
27+
}
928
},
10-
"rules": {
29+
plugins: {
30+
jest: jestPlugin,
31+
'@typescript-eslint': tseslint.plugin
32+
},
33+
rules: {
1134
"i18n-text/no-en": "off",
1235
"eslint-comments/no-use": "off",
36+
"camelcase": "off",
37+
"sort-imports": "off",
38+
"semi": ["error", "never"],
1339
"import/no-namespace": "off",
1440
"no-unused-vars": "off",
1541
"filenames/match-regex": "off",
42+
"import/no-unresolved": "off",
1643
"@typescript-eslint/no-unused-vars": "error",
1744
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
1845
"@typescript-eslint/no-require-imports": "error",
1946
"@typescript-eslint/array-type": "error",
2047
"@typescript-eslint/await-thenable": "error",
2148
"@typescript-eslint/ban-ts-comment": "error",
22-
"camelcase": "off",
2349
"@typescript-eslint/consistent-type-assertions": "error",
2450
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
25-
"@typescript-eslint/func-call-spacing": ["error", "never"],
2651
"@typescript-eslint/no-array-constructor": "error",
2752
"@typescript-eslint/no-empty-interface": "error",
2853
"@typescript-eslint/no-explicit-any": "error",
@@ -32,7 +57,6 @@
3257
"@typescript-eslint/no-misused-new": "error",
3358
"@typescript-eslint/no-namespace": "error",
3459
"@typescript-eslint/no-non-null-assertion": "warn",
35-
"@typescript-eslint/no-unnecessary-qualifier": "error",
3660
"@typescript-eslint/no-unnecessary-type-assertion": "error",
3761
"@typescript-eslint/no-useless-constructor": "error",
3862
"@typescript-eslint/no-var-requires": "error",
@@ -42,16 +66,15 @@
4266
"@typescript-eslint/prefer-string-starts-ends-with": "error",
4367
"@typescript-eslint/promise-function-async": "error",
4468
"@typescript-eslint/require-array-sort-compare": "error",
45-
"@typescript-eslint/restrict-plus-operands": "error",
46-
"semi": "off",
47-
"@typescript-eslint/semi": ["error", "never"],
48-
"@typescript-eslint/type-annotation-spacing": "error",
49-
"@typescript-eslint/unbound-method": "error",
50-
"sort-imports": "off"
51-
},
52-
"env": {
53-
"node": true,
54-
"es6": true,
55-
"jest/globals": true
69+
"@typescript-eslint/restrict-plus-operands": "error"
70+
}
71+
},
72+
73+
// Test files configuration
74+
{
75+
files: ['**/*.test.ts'],
76+
languageOptions: {
77+
globals: jestPlugin.environments.globals.globals
5678
}
57-
}
79+
}
80+
];

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"build": "tsc",
88
"format": "prettier --write '**/*.ts'",
99
"format-check": "prettier --check '**/*.ts'",
10-
"lint": "eslint src/**/*.ts",
10+
"lint": "eslint --config eslint.config.mjs src/**/*.ts",
1111
"package": "ncc build --source-map --license licenses.txt",
1212
"test": "jest",
1313
"all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
@@ -28,22 +28,23 @@
2828
"dependencies": {
2929
"@actions/core": "1.11.1",
3030
"@datadog/datadog-ci": "^3.2.0",
31-
"@typescript-eslint/eslint-plugin": "5",
3231
"axios": "^1.8.4"
3332
},
3433
"devDependencies": {
34+
"@eslint/eslintrc": "^3.3.1",
3535
"@types/jest": "^27.4.0",
3636
"@types/node": "^22",
37-
"@typescript-eslint/parser": "^5.48.2",
3837
"@vercel/ncc": "^0.38.3",
39-
"eslint": "^8.46.0",
38+
"eslint": "^8.57.0",
4039
"eslint-plugin-github": "^6.0.0",
4140
"eslint-plugin-jest": "^28.11.0",
4241
"eslint-plugin-prettier": "5.2.5",
42+
"globals": "^16.0.0",
4343
"jest": "^27.4.7",
4444
"js-yaml": "^4.1.0",
4545
"prettier": "^3.5.3",
4646
"ts-jest": "^27.1.3",
47-
"typescript": "^4.9.5"
47+
"typescript": "^4.9.5",
48+
"typescript-eslint": "^8.29.0"
4849
}
4950
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"compilerOptions": {
33
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
4-
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
4+
"module": "commonjs",
5+
"moduleResolution": "node",
56
"outDir": "./lib", /* Redirect output structure to the directory. */
67
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
78
"strict": true, /* Enable all strict type-checking options. */

0 commit comments

Comments
 (0)