|
| 1 | +{ |
| 2 | + "root": true, |
| 3 | + "extends": ["@pega"], |
| 4 | + "parserOptions": { |
| 5 | + "project": "tsconfig.json", |
| 6 | + "ecmaVersion": 13 |
| 7 | + }, |
| 8 | + "settings": { |
| 9 | + "import/resolver": { |
| 10 | + "typescript": {}, |
| 11 | + "node": { |
| 12 | + "extensions": [".js", ".jsx"] |
| 13 | + } |
| 14 | + }, |
| 15 | + "react": { |
| 16 | + "version": "detect" |
| 17 | + } |
| 18 | + }, |
| 19 | + "ignorePatterns": ["node_modules", "packages/*/lib", "!.storybook", ".storybook/public"], |
| 20 | + "rules": { |
| 21 | + |
| 22 | + // Prettier recommends running separately from a linter. |
| 23 | + // https://prettier.io/docs/en/integrating-with-linters.html#notes |
| 24 | + "prettier/prettier": "off", |
| 25 | + |
| 26 | + // Disable rules from shared configs we're not ready for yet. |
| 27 | + "sonarjs/cognitive-complexity": "off", |
| 28 | + "sonarjs/no-identical-functions": "off", |
| 29 | + "sonarjs/no-duplicate-string": "off", |
| 30 | + "sonarjs/no-nested-template-literals": "off", |
| 31 | + |
| 32 | + // |
| 33 | + // JA - Override some default lint handling here |
| 34 | + "@typescript-eslint/array-type": ["error", { "default": "generic" }], |
| 35 | + // "import/extensions": ["warn", "never"], // Turning off for now (see below) |
| 36 | + |
| 37 | + // Note: the "0" means to allow it. 1 = warning, 2 = error |
| 38 | + // allowing this lets index.tsx files pass linting even though they only have an export (and no JSX) |
| 39 | + "react/jsx-filename-extension": [0, { "extensions": [".js", ".jsx", "*.ts", "*.tsx"] }], |
| 40 | + |
| 41 | + // |
| 42 | + // Initial release: turning these off; phase in to "warn" or "error" over time |
| 43 | + // For "quotes" and "@typescript-eslint/quotes", see override below for .ts/.tsx files |
| 44 | + "import/extensions": ["off", "never"], |
| 45 | + "import/named": "off", |
| 46 | + "import/no-cycle": "off", |
| 47 | + "import/no-duplicates": "off", |
| 48 | + "import/no-extraneous-dependencies": "off", |
| 49 | + "import/no-named-as-default": "off", |
| 50 | + "import/no-named-as-default-member": "off", |
| 51 | + "import/no-self-import": "off", |
| 52 | + "import/no-unresolved": "off", |
| 53 | + "import/no-useless-path-segments": "off", |
| 54 | + "import/order": "off", |
| 55 | + |
| 56 | + "no-else-return": "off", |
| 57 | + "no-restricted-syntax": "off", |
| 58 | + "no-underscore-dangle": "off", |
| 59 | + |
| 60 | + "jsx-a11y/alt-text": "off", |
| 61 | + "jsx-a11y/anchor-is-valid": "off", |
| 62 | + "jsx-a11y/click-events-have-key-events": "off", |
| 63 | + "jsx-a11y/label-has-associated-control": "off", |
| 64 | + "jsx-a11y/no-static-element-interactions": "off", |
| 65 | + |
| 66 | + "react/jsx-fragments": "off", |
| 67 | + "react/jsx-no-bind": "off", |
| 68 | + "react/self-closing-comp": "off", |
| 69 | + |
| 70 | + "sonarjs/prefer-immediate-return": "off", |
| 71 | + |
| 72 | + "@typescript-eslint/dot-notation": "off", // prefer warn but needs different parserOptions |
| 73 | + "@typescript-eslint/naming-convention": "off", // prefer warn but needs different parserOptions |
| 74 | + "@typescript-eslint/ban-types": "off", // also, see override below |
| 75 | + |
| 76 | + // |
| 77 | + // Initial release: set to error |
| 78 | + "@typescript-eslint/no-inferrable-types": "error", |
| 79 | + "eqeqeq": "error", |
| 80 | + "no-alert": "error", |
| 81 | + "no-console": "error", |
| 82 | + "no-fallthrough": "error", |
| 83 | + "no-undef": "error", |
| 84 | + "no-unused-vars": "error", |
| 85 | + "no-var": "error", |
| 86 | + "prefer-const": "error", |
| 87 | + "yoda": "error", |
| 88 | + |
| 89 | + "import/no-mutable-exports": "error", |
| 90 | + "sonarjs/max-switch-cases": "error", |
| 91 | + "sonarjs/no-collapsible-if": "error", |
| 92 | + "sonarjs/no-all-duplicated-branches": "error", |
| 93 | + "sonarjs/no-duplicated-branches": "error", |
| 94 | + "sonarjs/no-gratuitous-expressions": "error", |
| 95 | + "sonarjs/no-ignored-return": "error", |
| 96 | + "sonarjs/no-small-switch": "error", |
| 97 | + "sonarjs/prefer-object-literal": "error", |
| 98 | + "sonarjs/prefer-single-boolean-return": "error", |
| 99 | + "@typescript-eslint/no-shadow": "error", |
| 100 | + "react/default-props-match-prop-types": "error", |
| 101 | + "react/no-unescaped-entities": "error", |
| 102 | + "react/no-unused-prop-types": "error", |
| 103 | + "react/static-property-placement": "error", |
| 104 | + "array-callback-return": "error", |
| 105 | + "camelcase": "error", |
| 106 | + "default-case": "error", |
| 107 | + "func-names": "error", |
| 108 | + "no-case-declarations": "error", |
| 109 | + "no-lonely-if": "error", |
| 110 | + "no-nested-ternary": "error", |
| 111 | + "no-plusplus": "error", |
| 112 | + "no-restricted-globals": "error", |
| 113 | + "no-restricted-properties": "error", |
| 114 | + "no-shadow": "error", |
| 115 | + "radix": "error", |
| 116 | + "spaced-comment": "error", |
| 117 | + |
| 118 | + "import/newline-after-import": "error", |
| 119 | + "sonarjs/no-nested-switch": "error", |
| 120 | + "@typescript-eslint/no-array-constructor": "error", |
| 121 | + "@typescript-eslint/no-empty-function": "error", |
| 122 | + "@typescript-eslint/no-unused-vars": "error", |
| 123 | + "@typescript-eslint/no-useless-constructor": "error", |
| 124 | + "react/button-has-type": "error", |
| 125 | + "react/jsx-curly-brace-presence": "error", |
| 126 | + "react/jsx-boolean-value": "error", |
| 127 | + "react/no-array-index-key": "error", |
| 128 | + "class-methods-use-this": "error", |
| 129 | + "guard-for-in": "error", |
| 130 | + "no-unneeded-ternary": "error", |
| 131 | + "no-unused-expressions": "error", |
| 132 | + "operator-assignment": "error", |
| 133 | + "prefer-template": "error", |
| 134 | + "vars-on-top": "error", |
| 135 | + |
| 136 | + "no-use-before-define": "off", // doc for @typescript-eslint/no-use-before-define says to turn off the base implementation |
| 137 | + "@typescript-eslint/no-use-before-define": "error" |
| 138 | + |
| 139 | + }, |
| 140 | + "overrides": [ |
| 141 | + { |
| 142 | + "files": "*.@(ts|tsx)", |
| 143 | + "rules": { |
| 144 | + "@typescript-eslint/method-signature-style": ["error", "property"], |
| 145 | + // "@typescript-eslint/ban-types": [ |
| 146 | + // "warn", |
| 147 | + // { |
| 148 | + // "types": { |
| 149 | + // "Omit": "Please use the 'OmitStrict' type from 'src/types/' instead.", |
| 150 | + // "object": false, |
| 151 | + // "Function": false |
| 152 | + // }, |
| 153 | + // "extendDefaults": true |
| 154 | + // } |
| 155 | + // ], |
| 156 | + |
| 157 | + "quotes": "off", |
| 158 | + "@typescript-eslint/quotes": "off" |
| 159 | + // [ |
| 160 | + // "error", |
| 161 | + // "single", |
| 162 | + // { |
| 163 | + // "avoidEscape": true, |
| 164 | + // "allowTemplateLiterals": false |
| 165 | + // } |
| 166 | + // ] |
| 167 | + } |
| 168 | + }, |
| 169 | + { |
| 170 | + "files": "*.@(jsx|tsx|mdx)", |
| 171 | + "rules": { |
| 172 | + "react/react-in-jsx-scope": "off", |
| 173 | + // Set up configuration for future sweep |
| 174 | + "react-hooks/exhaustive-deps": [ |
| 175 | + "off", |
| 176 | + { |
| 177 | + "additionalHooks": "useAfterInitialEffect" |
| 178 | + } |
| 179 | + ] |
| 180 | + } |
| 181 | + }, |
| 182 | + { |
| 183 | + "files": "*.@(js|jsx|ts|tsx|mdx)", |
| 184 | + "rules": { |
| 185 | + } |
| 186 | + }, |
| 187 | + { |
| 188 | + "files": ".storybook/*.js", |
| 189 | + "extends": ["@pega/eslint-config/script"] |
| 190 | + }, |
| 191 | + { |
| 192 | + "files": "*/**/mocks/**.@(mocks|styles).@(tsx|ts)", |
| 193 | + "rules": { |
| 194 | + "import/prefer-default-export": ["off"] |
| 195 | + } |
| 196 | + } |
| 197 | + ] |
| 198 | +} |
0 commit comments