Skip to content

Commit 6969db9

Browse files
authored
Migrate JSInterop to ESLint (#39162)
* Migrate JSInterop to ESLint * Update .js * Remove tslint.json * Fix spacing * PR Feedback * Update .devcontainer/devcontainer.json
1 parent 3c40d53 commit 6969db9

File tree

8 files changed

+1518
-631
lines changed

8 files changed

+1518
-631
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"extensions": [
2121
"ms-dotnettools.csharp",
2222
"EditorConfig.EditorConfig",
23-
"k--kato.docomment"
23+
"k--kato.docomment",
24+
"dbaeumer.vscode-eslint"
2425
],
2526
"settings": {
2627
// Loading projects on demand is better for larger codebases

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/dist/Release/blazor.webview.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": 12,
13+
"sourceType": "module"
14+
},
15+
"plugins": [
16+
"@typescript-eslint"
17+
],
18+
"rules": {
19+
"accessor-pairs": "error",
20+
"array-bracket-newline": "error",
21+
"array-bracket-spacing": "error",
22+
"array-callback-return": "error",
23+
"array-element-newline": "error",
24+
"arrow-spacing": "error",
25+
"block-scoped-var": "error",
26+
"block-spacing": "error",
27+
"brace-style": "error",
28+
"camelcase": "error",
29+
"class-methods-use-this": "error",
30+
"comma-dangle": "error",
31+
"comma-spacing": "error",
32+
"comma-style": "error",
33+
"complexity": "error",
34+
"computed-property-spacing": "error",
35+
"consistent-return": "error",
36+
"consistent-this": "error",
37+
"curly": "error",
38+
"default-case": "error",
39+
"default-case-last": "error",
40+
"default-param-last": "error",
41+
"dot-location": "error",
42+
"dot-notation": "error",
43+
"eol-last": "error",
44+
"eqeqeq": "error",
45+
"func-call-spacing": "error",
46+
"func-name-matching": "error",
47+
"func-names": "error",
48+
"function-paren-newline": "error",
49+
"generator-star-spacing": "error",
50+
"grouped-accessor-pairs": "error",
51+
"guard-for-in": "error",
52+
"id-denylist": "error",
53+
"id-length": "error",
54+
"id-match": "error",
55+
"implicit-arrow-linebreak": "error",
56+
"indent": "error",
57+
"jsx-quotes": "error",
58+
"key-spacing": "error",
59+
"keyword-spacing": "error",
60+
"linebreak-style": "error",
61+
"lines-between-class-members": "error",
62+
"max-classes-per-file": "off",
63+
"max-depth": "error",
64+
"max-len": [
65+
"error",
66+
{
67+
"code": 300
68+
}
69+
],
70+
"max-lines": "off",
71+
"max-lines-per-function": "error",
72+
"max-nested-callbacks": "error",
73+
"max-statements-per-line": "error",
74+
"multiline-comment-style": [
75+
"warn",
76+
"separate-lines"
77+
],
78+
"new-cap": "error",
79+
"new-parens": "error",
80+
"newline-per-chained-call": "error",
81+
"no-alert": "error",
82+
"no-array-constructor": "error",
83+
"no-await-in-loop": "error",
84+
"no-bitwise": "off",
85+
"no-caller": "error",
86+
"no-confusing-arrow": "error",
87+
"no-console": "off",
88+
"no-constructor-return": "error",
89+
"no-continue": "error",
90+
"no-div-regex": "error",
91+
"no-duplicate-imports": "error",
92+
"no-else-return": "error",
93+
"no-empty-function": "error",
94+
"no-eq-null": "error",
95+
"no-eval": "error",
96+
"no-extend-native": "error",
97+
"no-extra-bind": "error",
98+
"no-extra-label": "error",
99+
"no-floating-decimal": "error",
100+
"no-implicit-coercion": "error",
101+
"no-implicit-globals": "error",
102+
"no-implied-eval": "error",
103+
"no-invalid-this": "error",
104+
"no-iterator": "error",
105+
"no-label-var": "error",
106+
"no-labels": "error",
107+
"no-lone-blocks": "error",
108+
"no-lonely-if": "error",
109+
"no-loop-func": "error",
110+
"no-mixed-operators": "error",
111+
"no-multi-assign": "error",
112+
"no-multi-spaces": "error",
113+
"no-multi-str": "error",
114+
"no-multiple-empty-lines": "error",
115+
"no-namespace": "off",
116+
"no-negated-condition": "error",
117+
"no-nested-ternary": "error",
118+
"no-new": "error",
119+
"no-new-func": "error",
120+
"no-new-object": "error",
121+
"no-new-wrappers": "error",
122+
"no-octal-escape": "error",
123+
"no-promise-executor-return": "error",
124+
"no-proto": "error",
125+
"no-restricted-exports": "error",
126+
"no-restricted-globals": "error",
127+
"no-restricted-imports": "error",
128+
"no-restricted-properties": "error",
129+
"no-restricted-syntax": "error",
130+
"no-return-assign": "error",
131+
"no-return-await": "error",
132+
"no-script-url": "error",
133+
"no-self-compare": "error",
134+
"no-sequences": "error",
135+
"no-shadow": "error",
136+
"no-tabs": "error",
137+
"no-template-curly-in-string": "error",
138+
"no-throw-literal": "error",
139+
"no-trailing-spaces": "error",
140+
"no-undef-init": "error",
141+
"no-unmodified-loop-condition": "error",
142+
"no-unneeded-ternary": "error",
143+
"no-unreachable-loop": "error",
144+
"no-unused-expressions": "error",
145+
"no-unused-private-class-members": "error",
146+
"no-useless-call": "error",
147+
"no-useless-computed-key": "error",
148+
"no-useless-concat": "error",
149+
"no-useless-rename": "error",
150+
"no-useless-return": "error",
151+
"no-var": "error",
152+
"no-void": "error",
153+
"no-warning-comments": "error",
154+
"no-whitespace-before-property": "error",
155+
"nonblock-statement-body-position": "error",
156+
"object-curly-newline": "error",
157+
"object-shorthand": "error",
158+
"one-var-declaration-per-line": "error",
159+
"operator-assignment": "error",
160+
"operator-linebreak": "error",
161+
"padding-line-between-statements": "error",
162+
"prefer-const": "error",
163+
"prefer-destructuring": "error",
164+
"prefer-exponentiation-operator": "error",
165+
"prefer-named-capture-group": "error",
166+
"prefer-numeric-literals": "error",
167+
"prefer-object-has-own": "error",
168+
"prefer-object-spread": "error",
169+
"prefer-promise-reject-errors": "error",
170+
"prefer-regex-literals": "error",
171+
"prefer-rest-params": "error",
172+
"prefer-template": "error",
173+
"quotes": "error",
174+
"radix": "error",
175+
"require-atomic-updates": "error",
176+
"require-await": "error",
177+
"require-unicode-regexp": "error",
178+
"rest-spread-spacing": "error",
179+
"semi": "error",
180+
"semi-spacing": "error",
181+
"semi-style": "error",
182+
"sort-imports": "error",
183+
"sort-vars": "error",
184+
"space-before-blocks": "error",
185+
"space-in-parens": "error",
186+
"space-infix-ops": "error",
187+
"space-unary-ops": "error",
188+
"spaced-comment": "error",
189+
"strict": "error",
190+
"switch-colon-spacing": "error",
191+
"symbol-description": "error",
192+
"template-curly-spacing": "error",
193+
"template-tag-spacing": "error",
194+
"unicode-bom": "error",
195+
"vars-on-top": "error",
196+
"wrap-iife": "error",
197+
"wrap-regex": "error",
198+
"yield-star-spacing": "error",
199+
"yoda": "error",
200+
"prefer-spread": "warn",
201+
"object-property-newline": "off",
202+
"no-useless-constructor": "off",
203+
"prefer-arrow-callback": "off",
204+
"object-curly-spacing": "off",
205+
"@typescript-eslint/no-non-null-assertion": "off",
206+
"arrow-body-style": "off",
207+
"no-plusplus": "off",
208+
"no-undefined": "off",
209+
"quote-props": "off",
210+
"sort-keys": "off",
211+
"lines-around-comment": "off",
212+
"no-prototype-builtins": "off",
213+
"multiline-ternary": "off",
214+
"no-ternary": "off",
215+
"no-inner-declarations": "off",
216+
"max-params": "off",
217+
"no-param-reassign": "off",
218+
"no-magic-numbers": "off",
219+
"func-style": "off",
220+
"capitalized-comments": "off",
221+
"no-use-before-define": "off",
222+
"space-before-function-paren": "off",
223+
"init-declarations": "off",
224+
"arrow-parens": "off",
225+
"function-call-argument-newline": "off",
226+
"no-underscore-dangle": "off",
227+
"max-statements": "off",
228+
"padded-blocks": "off",
229+
"one-var": "off",
230+
"no-extra-parens": "off",
231+
"no-inline-comments": "off",
232+
"line-comment-position": "off",
233+
"@typescript-eslint/no-namespace": "off",
234+
"@typescript-eslint/prefer-namespace-keyword": "off",
235+
"@typescript-eslint/ban-types": [
236+
"error",
237+
{
238+
"types": {
239+
"Function": false
240+
}
241+
}
242+
]
243+
}
244+
}

src/JSInterop/Microsoft.JSInterop.JS/src/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/dotnet-js-interop",
3-
"version": "5.0.0-dev",
3+
"version": "7.0.0-dev",
44
"description": "Provides abstractions and features for interop between .NET and JavaScript code.",
55
"main": "dist/Microsoft.JSInterop.js",
66
"types": "dist/Microsoft.JSInterop.d.ts",
@@ -9,7 +9,7 @@
99
"preclean": "yarn install --mutex network --frozen-lockfile",
1010
"clean": "node node_modules/rimraf/bin.js ./dist",
1111
"build": "npm run clean && npm run build:esm",
12-
"build:lint": "node node_modules/tslint/bin/tslint -p ./tsconfig.json",
12+
"build:lint": "eslint -c .eslintrc.json --ext .ts ./src",
1313
"build:esm": "node node_modules/typescript/bin/tsc --project ./tsconfig.json"
1414
},
1515
"repository": {
@@ -26,8 +26,12 @@
2626
"dist/**"
2727
],
2828
"devDependencies": {
29+
"@typescript-eslint/eslint-plugin": "^5.8.0",
30+
"@typescript-eslint/parser": "^5.8.0",
31+
"eslint": "^8.5.0",
32+
"eslint-plugin-jsdoc": "^37.4.0",
33+
"eslint-plugin-prefer-arrow": "^1.2.3",
2934
"rimraf": "^3.0.2",
30-
"tslint": "^6.1.3",
3135
"typescript": "^4.2.2"
3236
}
3337
}

0 commit comments

Comments
 (0)