7 "extends": ["./node_modules/gts"],
11 "parser": "@typescript-eslint/parser",
12 "parserOptions": { "project": "./tsconfig.json" },
14 "plugin:import/errors",
15 "plugin:import/warnings",
16 "plugin:import/typescript",
17 "plugin:n/recommended"
19 "plugins": ["node", "ban", "import", "deprecation", "gpuweb-cts", "n"],
22 "linebreak-style": ["warn", "unix"],
24 "no-throw-literal": "warn",
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": [
36 { "terms": ["todo", "fixme", "xxx"], "location": "anywhere" }
39 "no-restricted-syntax": [
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\"]"
48 "message": "createBuffer must be immediately tracked using trackForCleanup (or use createBufferTracked).",
50 "selector": ":not(CallExpression[callee.property.name=\"trackForCleanup\"]) > CallExpression > MemberExpression > Identifier[name=\"createBuffer\"]"
53 "message": "createTexture must be immediately tracked using trackForCleanup (or use createTextureTracked).",
55 "selector": ":not(CallExpression[callee.property.name=\"trackForCleanup\"]) > CallExpression > MemberExpression > Identifier[name=\"createTexture\"]"
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\"]"
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",
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": [
89 // MAINTENANCE_TODO: Enable warnings for args
90 { "vars": "all", "args": "none", "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }
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",
115 "name": "setTimeout",
116 "message": "WPT disallows setTimeout; use `common/util/timeout.js`."
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": [
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."
141 "groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
142 "newlines-between": "always",
143 "alphabetize": { "order": "asc", "caseInsensitive": false }
146 "import/newline-after-import": ["warn", { "count": 1 }],
147 "import/no-duplicates": "warn",
148 "import/no-restricted-paths": [
153 "target": "./src/webgpu",
154 "from": "./src/common",
155 "except": ["./framework", "./util"],
156 "message": "Non-framework common/ code imported from webgpu/ suite"
159 "target": "./src/unittests",
160 "from": "./src/common",
161 "except": ["./framework", "./util", "./internal"],
162 "message": "Non-framework common/ code imported from unittests/ suite"
165 "target": "./src/webgpu",
166 "from": "./src/unittests",
167 "message": "unittests/ suite imported from webgpu/ suite"
170 "target": "./src/common",
172 "except": ["./common", "./external"],
173 "message": "Non common/ code imported from common/"
181 "./.eslint-resolver": {}