microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
cdp-node-version-compatibility

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.eslintrc.js

205lines · modecode

1const prettierConfig = require("./package.json").prettier;
2
3const isFix = process.argv.includes("--fix");
4
5module.exports = {
6 root: true,
7 ignorePatterns: ["**/*.d.ts", "**/*.js"],
8 env: {
9 node: true,
10 browser: false,
11 es2020: true,
12 },
13 parserOptions: {
14 ecmaVersion: 2020,
15 parser: require.resolve("@typescript-eslint/parser"),
16 project: "./tsconfig.json",
17 sourceType: "module",
18 tsconfigRootDir: __dirname,
19 },
20 plugins: ["@typescript-eslint", "prettier", "import", "promise", "unicorn", "header"],
21 extends: [
22 "plugin:@typescript-eslint/eslint-recommended",
23 "plugin:@typescript-eslint/recommended",
24 "plugin:@typescript-eslint/recommended-requiring-type-checking",
25 "plugin:promise/recommended",
26 "plugin:import/warnings",
27 "plugin:import/errors",
28 "plugin:import/typescript",
29 "prettier",
30 "prettier/@typescript-eslint",
31 ],
32 settings: {
33 "import/resolver": {
34 [require.resolve("eslint-import-resolver-typescript")]: {},
35 [require.resolve("eslint-import-resolver-node")]: {},
36 },
37 },
38 overrides: [],
39 rules: {
40 // before adding new rules - https://github.com/prettier/eslint-plugin-prettier/issues/65
41 "@typescript-eslint/await-thenable": "warn",
42 "@typescript-eslint/dot-notation": "warn",
43 "@typescript-eslint/explicit-function-return-type": "off",
44 "@typescript-eslint/explicit-module-boundary-types": [
45 "warn",
46 {
47 allowArgumentsExplicitlyTypedAsAny: true,
48 },
49 ],
50 "@typescript-eslint/lines-between-class-members": "off",
51 "@typescript-eslint/no-base-to-string": "off",
52 "@typescript-eslint/no-empty-function": "off",
53 "@typescript-eslint/no-explicit-any": "off",
54 "@typescript-eslint/no-inferrable-types": [
55 "warn",
56 {
57 ignoreParameters: true,
58 ignoreProperties: true,
59 },
60 ],
61 "@typescript-eslint/no-misused-promises": "off",
62 "@typescript-eslint/no-namespace": "off",
63 "@typescript-eslint/no-redundant-type-constituents": "off",
64 "@typescript-eslint/no-shadow": "off",
65 "@typescript-eslint/no-unnecessary-type-assertion": "off",
66 "@typescript-eslint/no-unnecessary-type-constraint": "off",
67 "@typescript-eslint/no-unsafe-argument": "off",
68 "@typescript-eslint/no-unsafe-assignment": "off",
69 "@typescript-eslint/no-unsafe-call": "off",
70 "@typescript-eslint/no-unsafe-enum-comparison": "off",
71 "@typescript-eslint/no-unsafe-member-access": "off",
72 "@typescript-eslint/no-unsafe-return": "off",
73 "@typescript-eslint/no-unused-vars": "warn",
74 "@typescript-eslint/no-use-before-define": [
75 // function hoisting is a common, accepted pattern
76 "error",
77 {
78 classes: true,
79 functions: false,
80 typedefs: true,
81 variables: true,
82 },
83 ],
84 "@typescript-eslint/prefer-regexp-exec": "off",
85 "@typescript-eslint/require-await": "off",
86 "class-methods-use-this": "off",
87 "consistent-return": "off",
88 eqeqeq: "warn",
89 "header/header": [
90 "error",
91 "line",
92 [
93 " Copyright (c) Microsoft Corporation. All rights reserved.",
94 " Licensed under the MIT license. See LICENSE file in the project root for details.",
95 ],
96 ],
97 "import/extensions": [
98 "error",
99 "always",
100 {
101 js: "never",
102 jsx: "never",
103 mjs: "never",
104 ts: "never",
105 tsx: "never",
106 },
107 ],
108 "import/newline-after-import": "warn",
109 "import/no-cycle": "off",
110 "import/no-extraneous-dependencies": "off",
111 "import/no-mutable-exports": "off",
112 "import/no-require": "off",
113 "import/no-unresolved": "off",
114 "import/no-useless-path-segments": "warn",
115 "import/order": "warn",
116 "import/prefer-default-export": "off",
117 "linebreak-style": "off",
118 "lines-between-class-members": "off",
119 "max-classes-per-file": "off",
120 "no-async-promise-executor": "warn",
121 "no-await-in-loop": "warn",
122 "no-else-return": "warn",
123 "no-empty-function": "off",
124 "no-extra-boolean-cast": "warn",
125 "no-lonely-if": "warn",
126 "no-nested-ternary": "warn",
127 "no-param-reassign": "warn",
128 "no-plusplus": "off",
129 "no-promise-executor-return": "error",
130 "no-restricted-globals": "warn",
131 "no-restricted-syntax": [
132 "error",
133 {
134 message:
135 "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
136 selector: "ForInStatement",
137 },
138 {
139 message:
140 "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
141 selector: "LabeledStatement",
142 },
143 {
144 message:
145 "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
146 selector: "WithStatement",
147 },
148 ],
149 "no-shadow": "off",
150 "no-undef-init": "error",
151 "no-underscore-dangle": "off",
152 "no-unneeded-ternary": "warn",
153 "no-useless-computed-key": "error",
154 "no-useless-escape": "warn",
155 "no-useless-return": "off",
156 "no-void": [
157 "error",
158 {
159 allowAsStatement: true,
160 },
161 ],
162 "object-shorthand": "warn",
163 "prefer-destructuring": "off",
164 "prefer-template": "error",
165 "prettier/prettier": ["error", prettierConfig],
166 "promise/always-return": "off",
167 "promise/catch-or-return": "off",
168 "promise/param-names": "off",
169 "promise/valid-params": "warn",
170 "spaced-comment": [
171 "error",
172 "always",
173 {
174 markers: ["/"],
175 },
176 ],
177 "unicorn/better-regex": "warn",
178 "unicorn/filename-case": [
179 "warn",
180 {
181 cases: {
182 camelCase: true, // pascalCase: true,
183 },
184 ignore: [/rn-extension\.ts/],
185 },
186 ],
187 "unicorn/no-array-reduce": "warn",
188 "unicorn/no-for-loop": isFix ? "off" : "warn",
189 "unicorn/no-instanceof-array": "warn",
190 "unicorn/no-new-array": "warn",
191 "unicorn/no-new-buffer": "warn",
192 "unicorn/prefer-array-find": "warn",
193 "unicorn/prefer-array-index-of": "warn",
194 "unicorn/prefer-array-some": "warn",
195 "unicorn/prefer-includes": "warn",
196 "unicorn/prefer-ternary": isFix ? "off" : "warn",
197 "use-isnan": "warn",
198 "valid-typeof": "warn",
199 yoda: "warn",
200 },
201
202 globals: {
203 process: "readonly",
204 },
205};
206