Backed out changeset 9d8b4c0b99ed (bug 1945683) for causing btime failures. CLOSED...
[gecko.git] / dom / webgpu / tests / cts / checkout / .eslintrc.json
blob969f6f09fb49f122477b42286e594bcea46c8ad3
2   "root": true,
3   "env": {
4     "browser": true,
5     "node": true
6   },
7   "extends": ["./node_modules/gts"],
8   "overrides": [
9     {
10       "files": ["**/*.ts"],
11       "parser": "@typescript-eslint/parser",
12       "parserOptions": { "project": "./tsconfig.json" },
13       "extends": [
14         "plugin:import/errors",
15         "plugin:import/warnings",
16         "plugin:import/typescript",
17         "plugin:n/recommended"
18       ],
19       "plugins": ["node", "ban", "import", "deprecation", "gpuweb-cts", "n"],
20       "rules": {
21         // Core rules
22         "linebreak-style": ["warn", "unix"],
23         "no-console": "warn",
24         "no-throw-literal": "warn",
25         "no-undef": "off",
26         "no-useless-rename": "warn",
27         "object-shorthand": "warn",
28         "prefer-promise-reject-errors": "warn",
29         "quotes": ["warn", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
31         // All test TODOs must be tracked inside file/test descriptions or READMEs.
32         // Comments relating to TODOs in descriptions can be marked with references like "[1]".
33         // TODOs not relating to test coverage can be marked MAINTENANCE_TODO or similar.
34         "no-warning-comments": [
35           "warn",
36           { "terms": ["todo", "fixme", "xxx"], "location": "anywhere" }
37         ],
39         "no-restricted-syntax": [
40           "warn",
41           {
42             "message": "createQuerySet must be immediately tracked using trackForCleanup (or use createQuerySetTracked).",
43             // This selector disallows any call to any method called "createQuerySet"
44             // that is not directly inside a call to some method called "trackForCleanup".
45             "selector": ":not(CallExpression[callee.property.name=\"trackForCleanup\"]) > CallExpression > MemberExpression > Identifier[name=\"createQuerySet\"]"
46           },
47           {
48             "message": "createBuffer must be immediately tracked using trackForCleanup (or use createBufferTracked).",
49             // Similar to above.
50             "selector": ":not(CallExpression[callee.property.name=\"trackForCleanup\"]) > CallExpression > MemberExpression > Identifier[name=\"createBuffer\"]"
51           },
52           {
53             "message": "createTexture must be immediately tracked using trackForCleanup (or use createTextureTracked).",
54             // Similar to above.
55             "selector": ":not(CallExpression[callee.property.name=\"trackForCleanup\"]) > CallExpression > MemberExpression > Identifier[name=\"createTexture\"]"
56           },
57           {
58             "message": "Use requestDeviceTracked() instead of requestDevice().",
59             // We don't seem to need direct calls to requestDevice() at all so we can just disallow all of them.
60             "selector": "CallExpression > MemberExpression > Identifier[name=\"requestDevice\"]"
61           }
62         ],
64         // Plugin: gpuweb-cts
65         "gpuweb-cts/string-trailing-space": "warn",
66         "gpuweb-cts/string-tabs": "warn",
68         // Plugin: @typescript-eslint
69         "@typescript-eslint/no-inferrable-types": "off",
70         "@typescript-eslint/consistent-type-assertions": "warn",
71         // Recommended lints
72         // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/README.md
73         "@typescript-eslint/adjacent-overload-signatures": "warn",
74         "@typescript-eslint/await-thenable": "warn",
75         "@typescript-eslint/ban-ts-comment": "warn",
76         "@typescript-eslint/no-empty-interface": "warn",
77         "@typescript-eslint/no-explicit-any": "warn",
78         "@typescript-eslint/no-extra-non-null-assertion": "warn",
79         "@typescript-eslint/no-floating-promises": "warn",
80         "@typescript-eslint/no-for-in-array": "warn",
81         "@typescript-eslint/no-misused-new": "warn",
82         "@typescript-eslint/no-namespace": "warn",
83         "@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
84         "@typescript-eslint/no-this-alias": "warn",
85         "@typescript-eslint/no-unnecessary-type-assertion": "warn",
86         "@typescript-eslint/no-unnecessary-type-constraint": "warn",
87         "@typescript-eslint/no-unused-vars": [
88           "warn",
89           // MAINTENANCE_TODO: Enable warnings for args
90           { "vars": "all", "args": "none", "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }
91         ],
92         "@typescript-eslint/prefer-as-const": "warn",
93         "@typescript-eslint/prefer-for-of": "warn",
94         "@typescript-eslint/prefer-namespace-keyword": "warn",
95         "@typescript-eslint/require-await": "warn",
96         "@typescript-eslint/restrict-plus-operands": "warn",
97         "@typescript-eslint/triple-slash-reference": "warn",
98         "@typescript-eslint/unbound-method": "warn",
99         // MAINTENANCE_TODO: Try to clean up and enable these recommended lints?
100         //"@typescript-eslint/no-unsafe-argument": "warn",
101         //"@typescript-eslint/no-unsafe-assignment": "warn",
102         //"@typescript-eslint/no-unsafe-call": "warn",
103         //"@typescript-eslint/no-unsafe-member-access": "warn",
104         //"@typescript-eslint/no-unsafe-return": "warn",
105         // Note: These recommended lints are probably not practical to enable.
106         //"@typescript-eslint/no-misused-promises": "warn",
107         //"@typescript-eslint/no-non-null-assertion": "warn",
108         //"@typescript-eslint/no-var-requires": "warn",
109         //"@typescript-eslint/restrict-template-expressions": "warn",
111         // Plugin: ban
112         "ban/ban": [
113           "warn",
114           {
115             "name": "setTimeout",
116             "message": "WPT disallows setTimeout; use `common/util/timeout.js`."
117           }
118         ],
120         // Plugin: deprecation
121         //"deprecation/deprecation": "warn",
123         // Plugin: n (for Node)
124         "n/no-unsupported-features/es-syntax": "off",
125         "n/no-unsupported-features/node-builtins": "off",
126         "n/no-restricted-require": ["warn", ["*"]],
127         "n/no-restricted-import": [
128           "warn",
129           [
130             {
131               "name": ["*", "!./**/*.js", "!../**/*.js"],
132               "message": "All imports must end in .js and be relative for Web. If this a Node-only file, use an eslint-disable directive or subdirectory .eslintrc.json to disable this lint."
133             }
134           ]
135         ],
137         // Plugin: import
138         "import/order": [
139           "warn",
140           {
141             "groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
142             "newlines-between": "always",
143             "alphabetize": { "order": "asc", "caseInsensitive": false }
144           }
145         ],
146         "import/newline-after-import": ["warn", { "count": 1 }],
147         "import/no-duplicates": "warn",
148         "import/no-restricted-paths": [
149           "warn",
150           {
151             "zones": [
152               {
153                 "target": "./src/webgpu",
154                 "from": "./src/common",
155                 "except": ["./framework", "./util"],
156                 "message": "Non-framework common/ code imported from webgpu/ suite"
157               },
158               {
159                 "target": "./src/unittests",
160                 "from": "./src/common",
161                 "except": ["./framework", "./util", "./internal"],
162                 "message": "Non-framework common/ code imported from unittests/ suite"
163               },
164               {
165                 "target": "./src/webgpu",
166                 "from": "./src/unittests",
167                 "message": "unittests/ suite imported from webgpu/ suite"
168               },
169               {
170                 "target": "./src/common",
171                 "from": "./src",
172                 "except": ["./common", "./external"],
173                 "message": "Non common/ code imported from common/"
174               }
175             ]
176           }
177         ]
178       },
179       "settings": {
180         "import/resolver": {
181           "./.eslint-resolver": {}
182         }
183       }
184     }
185   ]