Skip to content

Commit 2f3c3c2

Browse files
authored
feat(STARGATE-219): update typescript config (#55)
- switch to eslint flat config - migrate from old @typescript-eslint/* to the new typescript-eslint - migrate from old @angular-eslint/* to the new angular-eslint - bump minimum eslint version to 9.20 - add extensions to @typescript-eslint/no-unused-vars starting with _ - move from cmj to esm - add index.d.ts file
1 parent fd8eb90 commit 2f3c3c2

File tree

4 files changed

+210
-292
lines changed

4 files changed

+210
-292
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { ConfigArray } from "typescript-eslint";
2+
3+
declare const _default: ConfigArray;
4+
5+
export default _default;

eslint-config-typescript/index.js

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
1-
module.exports = {
2-
root: true,
3-
overrides: [
4-
{
5-
files: ["*.ts"],
6-
parserOptions: {
7-
project: ["tsconfig.json"],
8-
createDefaultProgram: true,
9-
},
10-
extends: [
11-
"eslint:recommended",
12-
"plugin:@typescript-eslint/recommended",
13-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
14-
"plugin:prettier/recommended",
15-
"prettier",
1+
// @ts-check
2+
import pluginTs from "typescript-eslint";
3+
import pluginJs from "@eslint/js";
4+
import pluginJest from "eslint-plugin-jest";
5+
import pluginPrettier from "eslint-config-prettier";
6+
7+
export default pluginTs.config(
8+
// config to all javascript and typescript files
9+
{
10+
files: ["**/*.ts", "**/*.js"],
11+
extends: [pluginJs.configs.recommended, pluginPrettier],
12+
rules: {
13+
"no-duplicate-imports": "error",
14+
},
15+
},
16+
{
17+
// config to all typescript files only
18+
files: ["**/*.ts"],
19+
extends: [pluginTs.configs.recommended, pluginTs.configs.stylistic],
20+
rules: {
21+
"@typescript-eslint/no-unused-vars": [
22+
"error",
23+
{
24+
argsIgnorePattern: "^_",
25+
caughtErrorsIgnorePattern: "^_",
26+
ignoreRestSiblings: true,
27+
},
1628
],
1729
},
18-
{
19-
files: ["*.spec.ts"],
20-
plugins: ["jest"],
21-
rules: {
22-
// See also https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md
23-
"@typescript-eslint/unbound-method": "off",
24-
"jest/unbound-method": "error",
25-
},
30+
},
31+
{
32+
// config to test files only
33+
files: ["**/*.spec.ts"],
34+
...pluginJest.configs["flat/recommended"],
35+
rules: {
36+
...pluginJest.configs["flat/recommended"].rules,
2637
},
27-
],
28-
};
38+
},
39+
);

0 commit comments

Comments
 (0)