Skip to content

Commit 415a884

Browse files
author
Konrad Jamrozik
authored
Migrate from TSLint to ESLint; update few other deps to latest (#335)
* Remove tslint, update minor deps * add eslint and prettier
1 parent edeaf8a commit 415a884

8 files changed

Lines changed: 2724 additions & 642 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,6 @@ dist/lib/dlls/**/*
220220

221221
*.d.ts.map
222222
*.js
223+
!eslint.config.js
223224
coverage/
224225
dlls/

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.json
2+
*.md
3+
*.jsonc
4+
.prettierrc
5+
azure-pipelines.yml

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"cSpell.words": [
3-
"yzhang"
4-
]
3+
],
4+
"azure-pipelines.1ESPipelineTemplatesSchemaFile": true
55
}

azure-pipelines.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ pool:
2222
steps:
2323
- script: npm ci
2424
displayName: npm ci
25+
- script: npm run lint
26+
displayName: lint
27+
- script: npm run prettier
28+
displayName: prettier
2529
- script: npm test
2630
displayName: test
2731
- script: npm pack

eslint.config.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// @ts-check
2+
3+
// This file contents based on:
4+
// https://typescript-eslint.io/getting-started#step-2-configuration
5+
// https://typescript-eslint.io/getting-started/typed-linting
6+
7+
import eslint from "@eslint/js"
8+
import { dirname } from "path"
9+
import tseslint from "typescript-eslint"
10+
import { fileURLToPath } from "url"
11+
12+
// Needed to support Node < 20.11 per:
13+
// https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules
14+
// as linked from: https://typescript-eslint.io/getting-started/typed-linting
15+
const __dirname = dirname(fileURLToPath(import.meta.url))
16+
17+
export default tseslint.config(
18+
eslint.configs.recommended,
19+
...tseslint.configs.recommendedTypeChecked,
20+
{
21+
languageOptions: {
22+
parserOptions: {
23+
project: true,
24+
tsconfigRootDir: __dirname
25+
}
26+
}
27+
},
28+
{
29+
// Based on https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores
30+
ignores: ["**/dist"]
31+
},
32+
{
33+
rules: {
34+
// Rules disabled as part of migration from tslint
35+
// https://github.com/Azure/openapi-diff/pull/335
36+
"@typescript-eslint/no-explicit-any": "off",
37+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
38+
"@typescript-eslint/no-unsafe-argument": "off",
39+
"@typescript-eslint/no-unsafe-assignment": "off",
40+
"@typescript-eslint/no-unsafe-call": "off",
41+
"@typescript-eslint/no-unsafe-member-access": "off",
42+
"@typescript-eslint/no-unsafe-return": "off",
43+
"@typescript-eslint/no-unused-vars": "off",
44+
"@typescript-eslint/no-var-requires": "off",
45+
"@typescript-eslint/restrict-template-expressions": "off",
46+
"no-constant-condition": "off",
47+
"no-useless-escape": "off",
48+
"prefer-const": "off"
49+
}
50+
}
51+
)

0 commit comments

Comments
 (0)