|
| 1 | +/** |
| 2 | + * Copyright 2025 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import js from "@eslint/js"; |
| 18 | +import prettier from "eslint-config-prettier"; |
| 19 | +import tseslint from "@typescript-eslint/eslint-plugin"; |
| 20 | +import tsparser from "@typescript-eslint/parser"; |
| 21 | + |
| 22 | +export default [ |
| 23 | + { |
| 24 | + ignores: [ |
| 25 | + "dist/**", |
| 26 | + "node_modules/**", |
| 27 | + "releases/**", |
| 28 | + "*.tgz", |
| 29 | + "**/dist/**", |
| 30 | + "**/node_modules/**", |
| 31 | + "**/build/**", |
| 32 | + "**/.next/**", |
| 33 | + "**/coverage/**", |
| 34 | + "**/.angular/**", |
| 35 | + "**/cache/**", |
| 36 | + "**/.cache/**", |
| 37 | + ], |
| 38 | + }, |
| 39 | + js.configs.recommended, |
| 40 | + prettier, |
| 41 | + { |
| 42 | + files: ["**/*.{js,jsx}"], |
| 43 | + languageOptions: { |
| 44 | + ecmaVersion: 2022, |
| 45 | + sourceType: "module", |
| 46 | + globals: { |
| 47 | + window: "readonly", |
| 48 | + console: "readonly", |
| 49 | + document: "readonly", |
| 50 | + process: "readonly", |
| 51 | + Buffer: "readonly", |
| 52 | + __dirname: "readonly", |
| 53 | + __filename: "readonly", |
| 54 | + global: "readonly", |
| 55 | + module: "readonly", |
| 56 | + require: "readonly", |
| 57 | + exports: "readonly", |
| 58 | + setImmediate: "readonly", |
| 59 | + clearImmediate: "readonly", |
| 60 | + URL: "readonly", |
| 61 | + clearInterval: "readonly", |
| 62 | + clearTimeout: "readonly", |
| 63 | + setTimeout: "readonly", |
| 64 | + setInterval: "readonly", |
| 65 | + }, |
| 66 | + }, |
| 67 | + rules: { |
| 68 | + "no-unused-vars": "off", |
| 69 | + "no-console": "warn", |
| 70 | + "prefer-const": "error", |
| 71 | + "no-var": "error", |
| 72 | + "no-undef": "off", |
| 73 | + }, |
| 74 | + }, |
| 75 | + { |
| 76 | + files: ["**/*.{ts,tsx}"], |
| 77 | + languageOptions: { |
| 78 | + ecmaVersion: 2022, |
| 79 | + sourceType: "module", |
| 80 | + parser: tsparser, |
| 81 | + parserOptions: { |
| 82 | + ecmaFeatures: { |
| 83 | + jsx: true, |
| 84 | + }, |
| 85 | + }, |
| 86 | + globals: { |
| 87 | + window: "readonly", |
| 88 | + console: "readonly", |
| 89 | + document: "readonly", |
| 90 | + process: "readonly", |
| 91 | + Buffer: "readonly", |
| 92 | + __dirname: "readonly", |
| 93 | + __filename: "readonly", |
| 94 | + global: "readonly", |
| 95 | + module: "readonly", |
| 96 | + require: "readonly", |
| 97 | + exports: "readonly", |
| 98 | + setImmediate: "readonly", |
| 99 | + clearImmediate: "readonly", |
| 100 | + URL: "readonly", |
| 101 | + clearInterval: "readonly", |
| 102 | + clearTimeout: "readonly", |
| 103 | + setTimeout: "readonly", |
| 104 | + setInterval: "readonly", |
| 105 | + React: "readonly", |
| 106 | + describe: "readonly", |
| 107 | + it: "readonly", |
| 108 | + expect: "readonly", |
| 109 | + beforeEach: "readonly", |
| 110 | + afterEach: "readonly", |
| 111 | + beforeAll: "readonly", |
| 112 | + afterAll: "readonly", |
| 113 | + vi: "readonly", |
| 114 | + test: "readonly", |
| 115 | + jest: "readonly", |
| 116 | + }, |
| 117 | + }, |
| 118 | + plugins: { |
| 119 | + "@typescript-eslint": tseslint, |
| 120 | + }, |
| 121 | + rules: { |
| 122 | + "no-unused-vars": "off", |
| 123 | + "no-undef": "off", |
| 124 | + "no-console": "warn", |
| 125 | + "prefer-const": "error", |
| 126 | + "no-var": "error", |
| 127 | + "@typescript-eslint/no-unused-vars": [ |
| 128 | + "error", |
| 129 | + { varsIgnorePattern: "^_", argsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" }, |
| 130 | + ], |
| 131 | + "@typescript-eslint/no-explicit-any": "warn", |
| 132 | + }, |
| 133 | + }, |
| 134 | +]; |
0 commit comments