|
| 1 | +{ |
| 2 | + "parser": "@typescript-eslint/parser", |
| 3 | + "extends": [ |
| 4 | + "eslint:recommended", |
| 5 | + "plugin:@typescript-eslint/recommended", |
| 6 | + "plugin:react/recommended", |
| 7 | + "plugin:react/jsx-runtime", |
| 8 | + "plugin:prettier/recommended", |
| 9 | + "plugin:no-unsanitized/DOM", |
| 10 | + "plugin:@vitest/legacy-recommended" |
| 11 | + ], |
| 12 | + "parserOptions": { |
| 13 | + "ecmaVersion": "latest", |
| 14 | + "sourceType": "module", |
| 15 | + "ecmaFeatures": { |
| 16 | + "jsx": true |
| 17 | + } |
| 18 | + }, |
| 19 | + "plugins": ["unicorn", "react-hooks", "no-unsanitized", "header", "import", "simple-import-sort", "@vitest"], |
| 20 | + "rules": { |
| 21 | + "@typescript-eslint/no-unused-vars": "error", |
| 22 | + "@typescript-eslint/consistent-type-definitions": ["error", "interface"], |
| 23 | + "@typescript-eslint/no-empty-function": "off", |
| 24 | + "@typescript-eslint/no-namespace": "off", |
| 25 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 26 | + "@typescript-eslint/no-explicit-any": "warn", |
| 27 | + "react/display-name": "off", |
| 28 | + "react/no-danger": "error", |
| 29 | + "react/no-unstable-nested-components": [ |
| 30 | + "error", |
| 31 | + { |
| 32 | + "allowAsProps": true |
| 33 | + } |
| 34 | + ], |
| 35 | + "react/forbid-component-props": [ |
| 36 | + "warn", |
| 37 | + { |
| 38 | + "forbid": ["className", "id"] |
| 39 | + } |
| 40 | + ], |
| 41 | + "react/jsx-boolean-value": ["error", "always"], |
| 42 | + "@typescript-eslint/naming-convention": [ |
| 43 | + "error", |
| 44 | + { |
| 45 | + "selector": "typeLike", |
| 46 | + "format": ["PascalCase"] |
| 47 | + } |
| 48 | + ], |
| 49 | + "react-hooks/rules-of-hooks": "error", |
| 50 | + "react-hooks/exhaustive-deps": ["error"], |
| 51 | + "unicorn/filename-case": "error", |
| 52 | + "curly": "error", |
| 53 | + "dot-notation": "error", |
| 54 | + "eqeqeq": "error", |
| 55 | + "no-return-await": "error", |
| 56 | + "require-await": "error", |
| 57 | + "header/header": [ |
| 58 | + "error", |
| 59 | + "line", |
| 60 | + [" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"] |
| 61 | + ], |
| 62 | + "no-restricted-imports": [ |
| 63 | + "error", |
| 64 | + { |
| 65 | + "paths": [ |
| 66 | + { |
| 67 | + "name": "react", |
| 68 | + "importNames": ["default"], |
| 69 | + "message": "Prefer named imports." |
| 70 | + }, |
| 71 | + { |
| 72 | + "name": "@cloudscape-design/components", |
| 73 | + "message": "Prefer subpath imports." |
| 74 | + } |
| 75 | + ] |
| 76 | + } |
| 77 | + ], |
| 78 | + "import/no-useless-path-segments": [ |
| 79 | + "warn", |
| 80 | + { |
| 81 | + "noUselessIndex": true |
| 82 | + } |
| 83 | + ], |
| 84 | + "simple-import-sort/imports": "warn", |
| 85 | + "@vitest/no-focused-tests": "error" |
| 86 | + }, |
| 87 | + "settings": { |
| 88 | + "react": { |
| 89 | + "version": "detect" |
| 90 | + } |
| 91 | + }, |
| 92 | + "env": { |
| 93 | + "browser": true, |
| 94 | + "es6": true |
| 95 | + }, |
| 96 | + "overrides": [ |
| 97 | + { |
| 98 | + "files": ["**/__integ__/**", "./test/**"], |
| 99 | + "rules": { |
| 100 | + // useBrowser is not a React hook |
| 101 | + "react-hooks/rules-of-hooks": "off", |
| 102 | + "react-hooks/exhaustive-deps": "off" |
| 103 | + }, |
| 104 | + "env": { |
| 105 | + "jest": true |
| 106 | + } |
| 107 | + }, |
| 108 | + { |
| 109 | + "files": ["src/**", "pages/**", "test/**", "scripts/**"], |
| 110 | + "rules": { |
| 111 | + "simple-import-sort/imports": [ |
| 112 | + "warn", |
| 113 | + { |
| 114 | + "groups": [ |
| 115 | + // External packages come first. |
| 116 | + ["^react", "^(?!@cloudscape)@?\\w"], |
| 117 | + // Cloudscape packages. |
| 118 | + ["^@cloudscape"], |
| 119 | + // Things that start with a letter (or digit or underscore), or `~` followed by a letter. |
| 120 | + ["^~?\\w"], |
| 121 | + // Anything not matched in another group. |
| 122 | + ["^"], |
| 123 | + // Styles come last. |
| 124 | + [ |
| 125 | + "^.+\\.?(css)$","^.+\\.?(css.js)$", "^.+\\.?(scss)$", "^.+\\.?(selectors.js)$" |
| 126 | + ] |
| 127 | + ] |
| 128 | + } |
| 129 | + ] |
| 130 | + } |
| 131 | + } |
| 132 | + ] |
| 133 | +} |
0 commit comments