Skip to content

Commit efa9388

Browse files
SW-5347 Replace TSlint with ESlint (#566)
1 parent a35a4a4 commit efa9388

27 files changed

+2238
-1649
lines changed

.eslintrc.js

Lines changed: 295 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
/*
2+
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3+
https://github.com/typescript-eslint/tslint-to-eslint-config
4+
5+
It represents the closest reasonable ESLint configuration to this
6+
project's original TSLint configuration.
7+
8+
We recommend eventually switching this configuration to extend from
9+
the recommended rulesets in typescript-eslint.
10+
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11+
12+
Happy linting! 💖
13+
*/
14+
module.exports = {
15+
env: {
16+
browser: true,
17+
},
18+
extends: [
19+
'plugin:@typescript-eslint/recommended',
20+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
21+
'plugin:react/recommended',
22+
'prettier',
23+
],
24+
parser: '@typescript-eslint/parser',
25+
parserOptions: {
26+
project: 'tsconfig.json',
27+
sourceType: 'module',
28+
},
29+
plugins: [
30+
'eslint-plugin-react',
31+
'eslint-plugin-jsdoc',
32+
'eslint-plugin-prefer-arrow',
33+
'@typescript-eslint',
34+
'@typescript-eslint/tslint',
35+
],
36+
root: true,
37+
rules: {
38+
'@typescript-eslint/no-unsafe-member-access': 'off',
39+
'@typescript-eslint/no-unsafe-return': 'off',
40+
'@typescript-eslint/no-unsafe-argument': 'off',
41+
'@typescript-eslint/no-unsafe-assignment': 'off',
42+
'@typescript-eslint/no-unsafe-call': 'off',
43+
'@typescript-eslint/adjacent-overload-signatures': 'error',
44+
'@typescript-eslint/array-type': [
45+
'error',
46+
{
47+
default: 'array',
48+
},
49+
],
50+
'@typescript-eslint/ban-types': [
51+
'warn',
52+
{
53+
types: {
54+
Object: {
55+
message: 'Avoid using the `Object` type. Did you mean `object`?',
56+
},
57+
Function: {
58+
message: 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.',
59+
},
60+
Boolean: {
61+
message: 'Avoid using the `Boolean` type. Did you mean `boolean`?',
62+
},
63+
Number: {
64+
message: 'Avoid using the `Number` type. Did you mean `number`?',
65+
},
66+
String: {
67+
message: 'Avoid using the `String` type. Did you mean `string`?',
68+
},
69+
Symbol: {
70+
message: 'Avoid using the `Symbol` type. Did you mean `symbol`?',
71+
},
72+
},
73+
},
74+
],
75+
'@typescript-eslint/consistent-type-assertions': 'error',
76+
'@typescript-eslint/dot-notation': 'error',
77+
'@typescript-eslint/explicit-function-return-type': 'off',
78+
'@typescript-eslint/explicit-module-boundary-types': 'off',
79+
'@typescript-eslint/indent': ['warn', 2],
80+
'@typescript-eslint/member-delimiter-style': [
81+
'error',
82+
{
83+
multiline: {
84+
delimiter: 'semi',
85+
requireLast: true,
86+
},
87+
singleline: {
88+
delimiter: 'semi',
89+
requireLast: false,
90+
},
91+
},
92+
],
93+
'@typescript-eslint/naming-convention': [
94+
'off',
95+
{
96+
selector: 'variable',
97+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
98+
leadingUnderscore: 'allow',
99+
trailingUnderscore: 'forbid',
100+
},
101+
],
102+
'@typescript-eslint/no-empty-function': 'error',
103+
'@typescript-eslint/no-empty-interface': 'error',
104+
'@typescript-eslint/no-explicit-any': 'off',
105+
'@typescript-eslint/no-misused-new': 'error',
106+
'@typescript-eslint/no-namespace': 'error',
107+
'@typescript-eslint/no-parameter-properties': 'off',
108+
'@typescript-eslint/no-shadow': [
109+
'error',
110+
{
111+
hoist: 'all',
112+
},
113+
],
114+
'@typescript-eslint/no-unused-expressions': 'error',
115+
'@typescript-eslint/no-use-before-define': 'off',
116+
'@typescript-eslint/no-var-requires': 'error',
117+
'@typescript-eslint/prefer-for-of': 'error',
118+
'@typescript-eslint/prefer-function-type': 'error',
119+
'@typescript-eslint/prefer-namespace-keyword': 'error',
120+
'@typescript-eslint/quotes': [
121+
'error',
122+
'single',
123+
{
124+
avoidEscape: true,
125+
},
126+
],
127+
'@typescript-eslint/require-await': 'error',
128+
'@typescript-eslint/semi': ['error', 'always'],
129+
'@typescript-eslint/triple-slash-reference': [
130+
'error',
131+
{
132+
path: 'always',
133+
types: 'prefer-import',
134+
lib: 'always',
135+
},
136+
],
137+
'@typescript-eslint/type-annotation-spacing': 'off',
138+
'@typescript-eslint/typedef': 'off',
139+
'@typescript-eslint/unified-signatures': 'error',
140+
'arrow-parens': ['error', 'always'],
141+
'brace-style': ['off', 'off'],
142+
'comma-dangle': 'off',
143+
complexity: 'off',
144+
'constructor-super': 'error',
145+
curly: 'error',
146+
'dot-notation': 'off',
147+
'eol-last': 'off',
148+
eqeqeq: ['error', 'always'],
149+
'guard-for-in': 'error',
150+
'id-denylist': [
151+
'error',
152+
'any',
153+
'Number',
154+
'number',
155+
'String',
156+
'string',
157+
'Boolean',
158+
'boolean',
159+
'Undefined',
160+
'undefined',
161+
],
162+
'id-match': 'error',
163+
indent: 'off',
164+
'jsdoc/check-alignment': 'error',
165+
'jsdoc/check-indentation': 'off',
166+
'jsdoc/newline-after-description': 'off',
167+
'linebreak-style': ['error', 'unix'],
168+
'max-classes-per-file': ['error', 1],
169+
'max-len': 'off',
170+
'new-parens': 'error',
171+
'newline-per-chained-call': 'off',
172+
'no-bitwise': 'error',
173+
'no-caller': 'error',
174+
'no-cond-assign': 'error',
175+
'no-console': [
176+
'error',
177+
{
178+
allow: [
179+
'warn',
180+
'dir',
181+
'time',
182+
'timeEnd',
183+
'timeLog',
184+
'trace',
185+
'assert',
186+
'clear',
187+
'count',
188+
'countReset',
189+
'group',
190+
'groupEnd',
191+
'table',
192+
'debug',
193+
'info',
194+
'dirxml',
195+
'error',
196+
'groupCollapsed',
197+
'Console',
198+
'profile',
199+
'profileEnd',
200+
'timeStamp',
201+
'context',
202+
'createTask',
203+
],
204+
},
205+
],
206+
'no-constant-condition': 'error',
207+
'no-debugger': 'error',
208+
'no-empty': 'error',
209+
'no-empty-function': 'off',
210+
'no-eval': 'error',
211+
'no-extra-semi': 'off',
212+
'no-fallthrough': 'off',
213+
'no-invalid-this': 'off',
214+
'no-irregular-whitespace': 'error',
215+
'no-multiple-empty-lines': 'off',
216+
'no-new-wrappers': 'error',
217+
'no-redeclare': 'error',
218+
'no-shadow': 'off',
219+
'no-sparse-arrays': 'error',
220+
'no-throw-literal': 'error',
221+
'no-trailing-spaces': 'error',
222+
'no-undef-init': 'error',
223+
'no-underscore-dangle': 'off',
224+
'no-unsafe-finally': 'error',
225+
'no-unused-expressions': 'off',
226+
'no-unused-labels': 'error',
227+
'no-use-before-define': 'off',
228+
'no-var': 'error',
229+
'object-shorthand': 'error',
230+
'one-var': ['error', 'never'],
231+
'padded-blocks': [
232+
'off',
233+
{
234+
blocks: 'never',
235+
},
236+
{
237+
allowSingleLineBlocks: true,
238+
},
239+
],
240+
'padding-line-between-statements': [
241+
'error',
242+
{
243+
blankLine: 'always',
244+
prev: '*',
245+
next: 'return',
246+
},
247+
],
248+
'prefer-arrow/prefer-arrow-functions': [
249+
'warn',
250+
{
251+
allowStandaloneDeclarations: true,
252+
},
253+
],
254+
'prefer-const': 'error',
255+
'quote-props': 'off',
256+
quotes: 'off',
257+
radix: 'error',
258+
'react/no-unescaped-entities': 'off',
259+
'react/jsx-boolean-value': 'off',
260+
'react/jsx-curly-spacing': 'off',
261+
'react/jsx-equals-spacing': 'off',
262+
'react/jsx-key': 'error',
263+
'react/jsx-no-bind': 'off',
264+
'react/jsx-tag-spacing': [
265+
'off',
266+
{
267+
afterOpening: 'allow',
268+
closingSlash: 'allow',
269+
},
270+
],
271+
'react/jsx-wrap-multilines': 'off',
272+
'react/self-closing-comp': 'error',
273+
'require-await': 'off',
274+
semi: 'off',
275+
'space-before-function-paren': 'off',
276+
'space-in-parens': ['off', 'never'],
277+
'spaced-comment': [
278+
'error',
279+
'always',
280+
{
281+
markers: ['/'],
282+
},
283+
],
284+
'use-isnan': 'error',
285+
'valid-typeof': 'off',
286+
'@typescript-eslint/tslint/config': [
287+
'error',
288+
{
289+
rules: {
290+
whitespace: true,
291+
},
292+
},
293+
],
294+
},
295+
};

.github/workflows/develop.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020

2121
- name: Set Environment
2222
run: .github/scripts/set-environment.sh
2323

2424
- name: Setup Node
25-
uses: actions/setup-node@v3
25+
uses: actions/setup-node@v4
2626
with:
27-
node-version: '16.x'
27+
node-version: '20.x'
2828
registry-url: 'https://registry.npmjs.org'
2929

3030
- name: Install Dependencies
@@ -45,14 +45,14 @@ jobs:
4545

4646
- name: Prune package.json
4747
run: |
48-
cd dist
49-
npm pkg delete scripts
50-
npm pkg delete devDependencies
51-
npm pkg delete eslintConfig
52-
npm pkg delete resolutions
53-
npm pkg delete browserslist
54-
pwd
55-
cat `pwd`/package.json
48+
cd dist
49+
npm pkg delete scripts
50+
npm pkg delete devDependencies
51+
npm pkg delete eslintConfig
52+
npm pkg delete resolutions
53+
npm pkg delete browserslist
54+
pwd
55+
cat `pwd`/package.json
5656
5757
- name: compare artifact package version
5858
run: .github/scripts/compare-artifact-package-versions.sh
@@ -61,4 +61,4 @@ jobs:
6161
if: env.UPDATE_NPM_PACKAGE == 'true'
6262
run: cd dist && npm publish --scope @terraware
6363
env:
64-
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_AUTH_TOKEN }}
64+
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_AUTH_TOKEN }}

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
id: yarn-cache-dir-path
3333
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
3434

35-
- uses: actions/cache@v3
35+
- uses: actions/cache@v4
3636
id: yarn-cache
3737
with:
3838
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -53,6 +53,6 @@ jobs:
5353
run: rm docs/.gitignore
5454

5555
- name: Deploy to GitHub Pages
56-
uses: JamesIves/github-pages-deploy-action@v4.4.1
56+
uses: JamesIves/github-pages-deploy-action@v4.6.1
5757
with:
5858
folder: docs

.github/workflows/open-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
name: 'Add Labels'
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2525

2626
- uses: actions/github-script@v6
2727
# skip auto patch labeling for dependabot or renovate PRs

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.validate": ["javascript", "javascriptreact", "html", "typescriptreact"]
3+
}

0 commit comments

Comments
 (0)