|
| 1 | +/* |
| 2 | + Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 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 { defineConfig, globalIgnores } from "eslint/config"; |
| 18 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 19 | +import prettier from "eslint-plugin-prettier"; |
| 20 | +import header from "eslint-plugin-header"; |
| 21 | +import globals from "globals"; |
| 22 | +import tsParser from "@typescript-eslint/parser"; |
| 23 | +import path from "node:path"; |
| 24 | +import { fileURLToPath } from "node:url"; |
| 25 | +import js from "@eslint/js"; |
| 26 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 27 | + |
| 28 | +header.rules.header.meta.schema = false; |
| 29 | +const __filename = fileURLToPath(import.meta.url); |
| 30 | +const __dirname = path.dirname(__filename); |
| 31 | +const compat = new FlatCompat({ |
| 32 | + baseDirectory: __dirname, |
| 33 | + recommendedConfig: js.configs.recommended, |
| 34 | + allConfig: js.configs.all |
| 35 | +}); |
| 36 | + |
| 37 | +export default defineConfig([ |
| 38 | + globalIgnores(["**/node_modules", "**/gradle", "**/dist", "**/coverage"]), |
| 39 | + { |
| 40 | + extends: compat.extends( |
| 41 | + "eslint:recommended", |
| 42 | + "plugin:@typescript-eslint/eslint-recommended", |
| 43 | + "plugin:@typescript-eslint/recommended", |
| 44 | + "plugin:prettier/recommended", |
| 45 | + "prettier" |
| 46 | + ), |
| 47 | + |
| 48 | + plugins: { |
| 49 | + "@typescript-eslint": typescriptEslint, |
| 50 | + prettier, |
| 51 | + header |
| 52 | + }, |
| 53 | + |
| 54 | + languageOptions: { |
| 55 | + globals: { |
| 56 | + ...globals.browser |
| 57 | + }, |
| 58 | + |
| 59 | + parser: tsParser, |
| 60 | + ecmaVersion: "latest", |
| 61 | + sourceType: "module" |
| 62 | + }, |
| 63 | + |
| 64 | + rules: { |
| 65 | + "@typescript-eslint/no-explicit-any": "off", |
| 66 | + "@typescript-eslint/no-unused-vars": "off", |
| 67 | + "@typescript-eslint/ban-ts-comment": "off", |
| 68 | + |
| 69 | + "prettier/prettier": [ |
| 70 | + "error", |
| 71 | + { |
| 72 | + endOfLine: "auto" |
| 73 | + } |
| 74 | + ], |
| 75 | + |
| 76 | + "header/header": [ |
| 77 | + 1, |
| 78 | + "block", |
| 79 | + [ |
| 80 | + "", |
| 81 | + " Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", |
| 82 | + " ", |
| 83 | + ' Licensed under the Apache License, Version 2.0 (the "License").', |
| 84 | + " You may not use this file except in compliance with the License.", |
| 85 | + " You may obtain a copy of the License at", |
| 86 | + " ", |
| 87 | + " http://www.apache.org/licenses/LICENSE-2.0", |
| 88 | + " ", |
| 89 | + " Unless required by applicable law or agreed to in writing, software", |
| 90 | + ' distributed under the License is distributed on an "AS IS" BASIS,', |
| 91 | + " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", |
| 92 | + " See the License for the specific language governing permissions and", |
| 93 | + " limitations under the License.", |
| 94 | + "" |
| 95 | + ], |
| 96 | + 2 |
| 97 | + ] |
| 98 | + } |
| 99 | + } |
| 100 | +]); |
0 commit comments