@workleap/eslint-configs 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/by-project-type/defineWebApplicationConfig.js.map +1 -1
- package/dist/core.js +2 -36
- package/dist/core.js.map +1 -1
- package/dist/react.js +4 -2
- package/dist/react.js.map +1 -1
- package/dist/typescript.js +38 -0
- package/dist/typescript.js.map +1 -1
- package/package.json +2 -2
- package/src/by-project-type/defineWebApplicationConfig.ts +22 -0
- package/src/core.ts +2 -13
- package/src/react.ts +5 -3
- package/src/typescript.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @workleap/eslint-configs
|
|
2
2
|
|
|
3
|
+
## 0.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#311](https://github.com/workleap/wl-web-configs/pull/311) [`4e0121d`](https://github.com/workleap/wl-web-configs/commit/4e0121d013f83a2305262c28b87a17960aeb5319) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fine tuning ESLint rules
|
|
8
|
+
|
|
9
|
+
## 0.0.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#309](https://github.com/workleap/wl-web-configs/pull/309) [`6eff339`](https://github.com/workleap/wl-web-configs/commit/6eff339662c6e46dac48ba5c23f8e52b2c7b157d) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fine tuning ESLint rules.
|
|
14
|
+
|
|
3
15
|
## 0.0.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"by-project-type/defineWebApplicationConfig.js","sources":["webpack://@workleap/eslint-configs/./src/by-project-type/defineWebApplicationConfig.ts"],"sourcesContent":["import { defineConfig, globalIgnores } from \"eslint/config\";\nimport { coreConfig, type CoreConfigOptions, coreGlobalIgnores } from \"../core.ts\";\nimport { jestConfig, type JestConfigOptions, jestGlobalIgnores } from \"../jest.ts\";\nimport { jsonConfig, JsonConfigOptions, jsonGlobalIgnores } from \"../json.ts\";\nimport { jsxAllyConfig, type JsxAllyConfigOptions, jsxAllyGlobalIgnores } from \"../jsxAlly.ts\";\nimport { packageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from \"../packageJson.ts\";\nimport { WorkleapPlugin } from \"../plugins/workleapPlugin.ts\";\nimport { reactConfig, type ReactConfigOptions, reactGlobalIgnores } from \"../react.ts\";\nimport { storybookConfig, type StorybookConfigOptions, storybookGlobalIgnores } from \"../storybook.ts\";\nimport { testingLibraryConfig, type TestingLibraryConfigOptions, testingLibraryGlobalIgnores } from \"../testingLibrary.ts\";\nimport { typescriptConfig, type TypescriptConfigOptions, typescriptGlobalIgnores } from \"../typescript.ts\";\nimport { vitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from \"../vitest.ts\";\nimport { yamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from \"../yaml.ts\";\n\n/*\n\nThe WHY for the interface instead of using nested \"extends\".\n\n1- ESlint flat config doesn't support nested \"extends\":\n\nEach configuration object may have an extends key, but only at the top level — not inside another config that already came from an extends.\n\nFlat config was designed to be explicitly ordered and fully expanded:\n\n- \"extends\" in flat config is syntactic sugar for concatenating multiple config objects.\n- Allowing recursion would make config evaluation order ambiguous and slow.\n\nSo ESLint enforces a one-level-deep rule:\n\n- only a top-level config object can have extends.\n\n2- Each object in the array is evaluated independently. \"plugins\" declared in one object are not inherited by the next object.\nSo when a second object sets the rule using a plugin \"xyz\", it doesn’t \"see\" the plugin \"xyz\" that’s defined inside a predefine config, and ESLint throws.\n\n3- Trying to redefine a plugin that as already been define in a configuration object will throw: Cannot redefine plugin \"xyz\".\n\n*/\n\n/*\n\nerror Parsing error: C:\\Dev\\workleap\\wl-web-configs\\samples\\storybook\\rsbuild\\.storybook\\main.ts was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject\n\n-> It usually means that the project tsconfig.json file cannot find the specified file\n-> Make sure to clear the ESLint cache after such an error because update the tsconfig.json file doesn't invalidate the ESLint cache\n\n*/\n\nexport interface DefineWebApplicationConfigOptions {\n core?: CoreConfigOptions;\n jest?: JestConfigOptions;\n json?: JsonConfigOptions;\n jsxAlly?: JsxAllyConfigOptions;\n packageJson?: PackageJsonConfigOptions;\n react?: ReactConfigOptions;\n storybook?: StorybookConfigOptions;\n testingLibrary?: TestingLibraryConfigOptions;\n typescript?: TypescriptConfigOptions;\n vitest?: VitestConfigOptions;\n yaml?: YamlConfigOptions;\n}\n\n/**\n * @param tsconfigRootDir The directory of the tsconfig file to use for rules that needs a TypeScript type check: https://typescript-eslint.io/packages/parser/#tsconfigrootdir.\n * @param options An optional object of options for the ESlint core and plugins rules.\n */\nexport const defineWebApplicationConfig = (tsconfigRootDir: string, options: DefineWebApplicationConfigOptions = {}) => {\n const {\n core,\n jest,\n json,\n jsxAlly,\n packageJson,\n react,\n storybook,\n testingLibrary,\n typescript,\n vitest,\n yaml\n } = options;\n\n return defineConfig([\n // node_modules folder is ignored by default.\n globalIgnores([\n \"dist\",\n \"**/__snapshots__/*\",\n \".turbo\",\n ...coreGlobalIgnores,\n ...jestGlobalIgnores,\n ...jsonGlobalIgnores,\n ...jsxAllyGlobalIgnores,\n ...packageJsonGlobalIgnores,\n ...reactGlobalIgnores,\n ...storybookGlobalIgnores,\n ...testingLibraryGlobalIgnores,\n ...typescriptGlobalIgnores,\n ...vitestGlobalIgnores,\n ...yamlGlobalIgnores\n ]),\n ...coreConfig(core),\n ...jestConfig(jest),\n ...jsonConfig(json),\n ...jsxAllyConfig(jsxAlly),\n ...packageJsonConfig(packageJson),\n ...reactConfig(react),\n ...storybookConfig(storybook),\n ...testingLibraryConfig(testingLibrary),\n ...typescriptConfig(tsconfigRootDir, typescript),\n // Temporary fix until the vitest plugin support defineConfig and the types are fixed.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(vitestConfig(vitest) as any),\n ...yamlConfig(yaml),\n {\n plugins: {\n \"@workleap\": WorkleapPlugin\n },\n rules: {\n \"@workleap/strict-css-modules-names\": \"warn\"\n }\n }\n ]);\n};\n"],"names":["defineConfig","globalIgnores","coreConfig","coreGlobalIgnores","jestConfig","jestGlobalIgnores","jsonConfig","jsonGlobalIgnores","jsxAllyConfig","jsxAllyGlobalIgnores","packageJsonConfig","packageJsonGlobalIgnores","WorkleapPlugin","reactConfig","reactGlobalIgnores","storybookConfig","storybookGlobalIgnores","testingLibraryConfig","testingLibraryGlobalIgnores","typescriptConfig","typescriptGlobalIgnores","vitestConfig","vitestGlobalIgnores","yamlConfig","yamlGlobalIgnores","defineWebApplicationConfig","tsconfigRootDir","options","core","jest","json","jsxAlly","packageJson","react","storybook","testingLibrary","typescript","vitest","yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA4D;AACuB;AACA;AACL;AACiB;AACgB;AACjD;AACyB;AACgB;AACoB;AAChB;AAChB;AACR;
|
|
1
|
+
{"version":3,"file":"by-project-type/defineWebApplicationConfig.js","sources":["webpack://@workleap/eslint-configs/./src/by-project-type/defineWebApplicationConfig.ts"],"sourcesContent":["import { defineConfig, globalIgnores } from \"eslint/config\";\nimport { coreConfig, type CoreConfigOptions, coreGlobalIgnores } from \"../core.ts\";\nimport { jestConfig, type JestConfigOptions, jestGlobalIgnores } from \"../jest.ts\";\nimport { jsonConfig, JsonConfigOptions, jsonGlobalIgnores } from \"../json.ts\";\nimport { jsxAllyConfig, type JsxAllyConfigOptions, jsxAllyGlobalIgnores } from \"../jsxAlly.ts\";\nimport { packageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from \"../packageJson.ts\";\nimport { WorkleapPlugin } from \"../plugins/workleapPlugin.ts\";\nimport { reactConfig, type ReactConfigOptions, reactGlobalIgnores } from \"../react.ts\";\nimport { storybookConfig, type StorybookConfigOptions, storybookGlobalIgnores } from \"../storybook.ts\";\nimport { testingLibraryConfig, type TestingLibraryConfigOptions, testingLibraryGlobalIgnores } from \"../testingLibrary.ts\";\nimport { typescriptConfig, type TypescriptConfigOptions, typescriptGlobalIgnores } from \"../typescript.ts\";\nimport { vitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from \"../vitest.ts\";\nimport { yamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from \"../yaml.ts\";\n\n/*\n\nThe WHY for the interface instead of using nested \"extends\".\n\n1- ESlint flat config doesn't support nested \"extends\":\n\nEach configuration object may have an extends key, but only at the top level — not inside another config that already came from an extends.\n\nFlat config was designed to be explicitly ordered and fully expanded:\n\n- \"extends\" in flat config is syntactic sugar for concatenating multiple config objects.\n- Allowing recursion would make config evaluation order ambiguous and slow.\n\nSo ESLint enforces a one-level-deep rule:\n\n- only a top-level config object can have extends.\n\n2- Each object in the array is evaluated independently. \"plugins\" declared in one object are not inherited by the next object.\nSo when a second object sets the rule using a plugin \"xyz\", it doesn’t \"see\" the plugin \"xyz\" that’s defined inside a predefine config, and ESLint throws.\n\n3- Trying to redefine a plugin that as already been define in a configuration object will throw: Cannot redefine plugin \"xyz\".\n\n*/\n\n/*\n\nerror Parsing error: C:\\Dev\\workleap\\wl-web-configs\\samples\\storybook\\rsbuild\\.storybook\\main.ts was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject\n\n-> It usually means that the project tsconfig.json file cannot find the specified file\n-> Make sure to clear the ESLint cache after such an error because update the tsconfig.json file doesn't invalidate the ESLint cache\n\n*/\n\n/*\n\nimport { defineConfig, globalIgnores } from \"eslint/config\";\nimport { defineReactLibraryConfig } from \"@workleap/eslint-configs\";\n\nexport default defineConfig([\n globalIgnores([\n \"/reports/**\"\n ]),\n defineReactLibraryConfig(import.meta.dirname)\n]);\n\n*/\n\n/*\n\nThe key insight was that ESLint 9's flat config system requires ignores to be specified in the configuration\nfile itself for optimal performance, rather than relying on CLI flags (--ignore-pattern). The ignores array at the beginning of the\n config ensures files are filtered out during the file discovery phase, not after.\n\n*/\n\nexport interface DefineWebApplicationConfigOptions {\n core?: CoreConfigOptions;\n jest?: JestConfigOptions;\n json?: JsonConfigOptions;\n jsxAlly?: JsxAllyConfigOptions;\n packageJson?: PackageJsonConfigOptions;\n react?: ReactConfigOptions;\n storybook?: StorybookConfigOptions;\n testingLibrary?: TestingLibraryConfigOptions;\n typescript?: TypescriptConfigOptions;\n vitest?: VitestConfigOptions;\n yaml?: YamlConfigOptions;\n}\n\n/**\n * @param tsconfigRootDir The directory of the tsconfig file to use for rules that needs a TypeScript type check: https://typescript-eslint.io/packages/parser/#tsconfigrootdir.\n * @param options An optional object of options for the ESlint core and plugins rules.\n */\nexport const defineWebApplicationConfig = (tsconfigRootDir: string, options: DefineWebApplicationConfigOptions = {}) => {\n const {\n core,\n jest,\n json,\n jsxAlly,\n packageJson,\n react,\n storybook,\n testingLibrary,\n typescript,\n vitest,\n yaml\n } = options;\n\n return defineConfig([\n // node_modules folder is ignored by default.\n globalIgnores([\n \"dist\",\n \"**/__snapshots__/*\",\n \".turbo\",\n ...coreGlobalIgnores,\n ...jestGlobalIgnores,\n ...jsonGlobalIgnores,\n ...jsxAllyGlobalIgnores,\n ...packageJsonGlobalIgnores,\n ...reactGlobalIgnores,\n ...storybookGlobalIgnores,\n ...testingLibraryGlobalIgnores,\n ...typescriptGlobalIgnores,\n ...vitestGlobalIgnores,\n ...yamlGlobalIgnores\n ]),\n ...coreConfig(core),\n ...jestConfig(jest),\n ...jsonConfig(json),\n ...jsxAllyConfig(jsxAlly),\n ...packageJsonConfig(packageJson),\n ...reactConfig(react),\n ...storybookConfig(storybook),\n ...testingLibraryConfig(testingLibrary),\n ...typescriptConfig(tsconfigRootDir, typescript),\n // Temporary fix until the vitest plugin support defineConfig and the types are fixed.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(vitestConfig(vitest) as any),\n ...yamlConfig(yaml),\n {\n plugins: {\n \"@workleap\": WorkleapPlugin\n },\n rules: {\n \"@workleap/strict-css-modules-names\": \"warn\"\n }\n }\n ]);\n};\n"],"names":["defineConfig","globalIgnores","coreConfig","coreGlobalIgnores","jestConfig","jestGlobalIgnores","jsonConfig","jsonGlobalIgnores","jsxAllyConfig","jsxAllyGlobalIgnores","packageJsonConfig","packageJsonGlobalIgnores","WorkleapPlugin","reactConfig","reactGlobalIgnores","storybookConfig","storybookGlobalIgnores","testingLibraryConfig","testingLibraryGlobalIgnores","typescriptConfig","typescriptGlobalIgnores","vitestConfig","vitestGlobalIgnores","yamlConfig","yamlGlobalIgnores","defineWebApplicationConfig","tsconfigRootDir","options","core","jest","json","jsxAlly","packageJson","react","storybook","testingLibrary","typescript","vitest","yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA4D;AACuB;AACA;AACL;AACiB;AACgB;AACjD;AACyB;AACgB;AACoB;AAChB;AAChB;AACR;AAuEnF;;;CAGC,GACM,MAAMyB,6BAA6B,CAACC,iBAAyBC,UAA6C,CAAC,CAAC;IAC/G,MAAM,EACFC,IAAI,EACJC,IAAI,EACJC,IAAI,EACJC,OAAO,EACPC,WAAW,EACXC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,UAAU,EACVC,MAAM,EACNC,IAAI,EACP,GAAGX;IAEJ,OAAO3B,YAAYA,CAAC;QAChB,6CAA6C;QAC7CC,aAAaA,CAAC;YACV;YACA;YACA;eACGE,iBAAiBA;eACjBE,iBAAiBA;eACjBE,iBAAiBA;eACjBE,oBAAoBA;eACpBE,wBAAwBA;eACxBG,kBAAkBA;eAClBE,sBAAsBA;eACtBE,2BAA2BA;eAC3BE,uBAAuBA;eACvBE,mBAAmBA;eACnBE,iBAAiBA;SACvB;WACEtB,UAAUA,CAAC0B;WACXxB,UAAUA,CAACyB;WACXvB,UAAUA,CAACwB;WACXtB,aAAaA,CAACuB;WACdrB,iBAAiBA,CAACsB;WAClBnB,WAAWA,CAACoB;WACZlB,eAAeA,CAACmB;WAChBjB,oBAAoBA,CAACkB;WACrBhB,gBAAgBA,CAACO,iBAAiBU;QACrC,sFAAsF;QACtF,8DAA8D;WAC1Df,YAAYA,CAACgB;WACdd,UAAUA,CAACe;QACd;YACI,SAAS;gBACL,aAAa1B,cAAcA;YAC/B;YACA,OAAO;gBACH,sCAAsC;YAC1C;QACJ;KACH;AACL,EAAE"}
|
package/dist/core.js
CHANGED
|
@@ -81,44 +81,10 @@ function coreConfig(options = {}) {
|
|
|
81
81
|
"no-label-var": "warn",
|
|
82
82
|
"no-lone-blocks": "warn",
|
|
83
83
|
"no-loop-func": "warn",
|
|
84
|
-
"no-mixed-operators": [
|
|
85
|
-
"warn",
|
|
86
|
-
{
|
|
87
|
-
groups: [
|
|
88
|
-
[
|
|
89
|
-
"&",
|
|
90
|
-
"|",
|
|
91
|
-
"^",
|
|
92
|
-
"~",
|
|
93
|
-
"<<",
|
|
94
|
-
">>",
|
|
95
|
-
">>>"
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
-
"==",
|
|
99
|
-
"!=",
|
|
100
|
-
"===",
|
|
101
|
-
"!==",
|
|
102
|
-
">",
|
|
103
|
-
">=",
|
|
104
|
-
"<",
|
|
105
|
-
"<="
|
|
106
|
-
],
|
|
107
|
-
[
|
|
108
|
-
"&&",
|
|
109
|
-
"||"
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
"in",
|
|
113
|
-
"instanceof"
|
|
114
|
-
]
|
|
115
|
-
],
|
|
116
|
-
allowSamePrecedence: false
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
84
|
"no-multi-str": "warn",
|
|
120
85
|
"no-new-func": "warn",
|
|
121
|
-
|
|
86
|
+
// Deprecated but still no replacement in @stylistic.
|
|
87
|
+
// "no-new-object": "warn",
|
|
122
88
|
"no-new-wrappers": "warn",
|
|
123
89
|
"no-octal-escape": "warn",
|
|
124
90
|
"no-param-reassign": "warn",
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sources":["webpack://@workleap/eslint-configs/./src/core.ts"],"sourcesContent":["import js from \"@eslint/js\";\nimport type { Linter } from \"eslint\";\nimport importPlugin from \"eslint-plugin-import\";\nimport globals from \"globals\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface CoreConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const coreGlobalIgnores = [];\n\nexport function coreConfig(options: CoreConfigOptions = {}) {\n const {\n rules\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/core\",\n files: [\n \"**/*.{js,jsx,ts,tsx,cjs,mjs}\"\n ],\n plugins: {\n js,\n import: importPlugin\n },\n extends: [\n js.configs.recommended\n ],\n languageOptions: {\n ecmaVersion: \"latest\",\n sourceType: \"module\",\n globals: {\n ...globals.browser,\n ...globals.es2024,\n ...globals.node,\n ...globals.commonjs\n }\n },\n rules: {\n // Recommended rules overrides\n \"no-cond-assign\": [\"error\", \"except-parens\"],\n \"no-labels\": [\"warn\", { allowLoop: true, allowSwitch: false }],\n \"no-prototype-builtins\": \"off\",\n\n // Possible problems\n \"array-callback-return\": \"error\",\n \"no-self-compare\": \"error\",\n \"no-template-curly-in-string\": \"error\",\n \"no-use-before-define\": [\n \"error\",\n {\n functions: false,\n classes: false,\n variables: false\n }\n ],\n\n // Suggestions\n curly: \"warn\",\n eqeqeq: [\"warn\", \"smart\"],\n \"no-array-constructor\": \"warn\",\n \"no-caller\": \"warn\",\n \"no-eval\": \"warn\",\n \"no-extend-native\": \"warn\",\n \"no-extra-bind\": \"warn\",\n \"no-extra-label\": \"warn\",\n \"no-implied-eval\": \"warn\",\n \"no-iterator\": \"warn\",\n \"no-label-var\": \"warn\",\n \"no-lone-blocks\": \"warn\",\n \"no-loop-func\": \"warn\",\n \"no-
|
|
1
|
+
{"version":3,"file":"core.js","sources":["webpack://@workleap/eslint-configs/./src/core.ts"],"sourcesContent":["import js from \"@eslint/js\";\nimport type { Linter } from \"eslint\";\nimport importPlugin from \"eslint-plugin-import\";\nimport globals from \"globals\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface CoreConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const coreGlobalIgnores = [];\n\nexport function coreConfig(options: CoreConfigOptions = {}) {\n const {\n rules\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/core\",\n files: [\n \"**/*.{js,jsx,ts,tsx,cjs,mjs}\"\n ],\n plugins: {\n js,\n import: importPlugin\n },\n extends: [\n js.configs.recommended\n ],\n languageOptions: {\n ecmaVersion: \"latest\",\n sourceType: \"module\",\n globals: {\n ...globals.browser,\n ...globals.es2024,\n ...globals.node,\n ...globals.commonjs\n }\n },\n rules: {\n // Recommended rules overrides\n \"no-cond-assign\": [\"error\", \"except-parens\"],\n \"no-labels\": [\"warn\", { allowLoop: true, allowSwitch: false }],\n \"no-prototype-builtins\": \"off\",\n\n // Possible problems\n \"array-callback-return\": \"error\",\n \"no-self-compare\": \"error\",\n \"no-template-curly-in-string\": \"error\",\n \"no-use-before-define\": [\n \"error\",\n {\n functions: false,\n classes: false,\n variables: false\n }\n ],\n\n // Suggestions\n curly: \"warn\",\n eqeqeq: [\"warn\", \"smart\"],\n \"no-array-constructor\": \"warn\",\n \"no-caller\": \"warn\",\n \"no-eval\": \"warn\",\n \"no-extend-native\": \"warn\",\n \"no-extra-bind\": \"warn\",\n \"no-extra-label\": \"warn\",\n \"no-implied-eval\": \"warn\",\n \"no-iterator\": \"warn\",\n \"no-label-var\": \"warn\",\n \"no-lone-blocks\": \"warn\",\n \"no-loop-func\": \"warn\",\n \"no-multi-str\": \"warn\",\n \"no-new-func\": \"warn\",\n // Deprecated but still no replacement in @stylistic.\n // \"no-new-object\": \"warn\",\n \"no-new-wrappers\": \"warn\",\n \"no-octal-escape\": \"warn\",\n \"no-param-reassign\": \"warn\",\n \"no-restricted-properties\": \"warn\",\n \"no-restricted-globals\": [\"error\"],\n \"no-restricted-syntax\": [\"error\", \"WithStatement\"],\n \"no-script-url\": \"warn\",\n \"no-sequences\": \"warn\",\n \"no-shadow\": \"warn\",\n \"no-throw-literal\": \"warn\",\n \"no-unneeded-ternary\": \"warn\",\n \"no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: true,\n allowTernary: true,\n allowTaggedTemplates: true\n }\n ],\n \"no-useless-computed-key\": \"warn\",\n \"no-useless-concat\": \"warn\",\n \"no-useless-constructor\": \"warn\",\n \"no-useless-rename\": [\n \"warn\",\n {\n ignoreDestructuring: false,\n ignoreImport: false,\n ignoreExport: false\n }\n ],\n \"no-var\": \"warn\",\n \"prefer-const\": \"warn\",\n strict: [\"warn\", \"never\"],\n\n // Layout & Formatting\n \"unicode-bom\": [\"warn\", \"never\"],\n\n // https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules\n \"import/newline-after-import\": \"warn\",\n \"import/no-amd\": \"error\",\n \"import/no-duplicates\": \"warn\",\n \"import/no-self-import\": \"error\",\n \"import/no-webpack-loader-syntax\": \"error\",\n\n // Positioned last to allow the consumer to override any rules.\n ...rules\n }\n }];\n\n return config;\n};\n"],"names":["js","importPlugin","globals","coreGlobalIgnores","coreConfig","options","rules","config"],"mappings":";;;;;;;;;;;AAA4B;AAEoB;AAClB;AAOvB,MAAMG,oBAAoB,EAAE,CAAC;AAE7B,SAASC,WAAWC,UAA6B,CAAC,CAAC;IACtD,MAAM,EACFC,KAAK,EACR,GAAGD;IAEJ,MAAME,SAA8B;QAAC;YACjC,MAAM;YACN,OAAO;gBACH;aACH;YACD,SAAS;gBACLP,EAAEA,EAAAA,EAAAA;gBACF,QAAQC,oBAAYA;YACxB;YACA,SAAS;gBACLD,sBAAsB;aACzB;YACD,iBAAiB;gBACb,aAAa;gBACb,YAAY;gBACZ,SAAS;oBACL,GAAGE,eAAe;oBAClB,GAAGA,cAAc;oBACjB,GAAGA,YAAY;oBACf,GAAGA,gBAAgB;gBACvB;YACJ;YACA,OAAO;gBACH,8BAA8B;gBAC9B,kB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AAE;IAEF,OAAOC;AACX"}
|
package/dist/react.js
CHANGED
|
@@ -121,6 +121,10 @@ function reactConfig(options = {}) {
|
|
|
121
121
|
"react/jsx-one-expression-per-line": "off",
|
|
122
122
|
"react/jsx-tag-spacing": "off",
|
|
123
123
|
"react/jsx-wrap-multilines": "off",
|
|
124
|
+
// React Hooks Recommend rules overrides
|
|
125
|
+
"react-hooks/set-state-in-effect": "off",
|
|
126
|
+
// Should be enabled later when we better understand the rule.
|
|
127
|
+
"react-hooks/preserve-manual-memoization": "off",
|
|
124
128
|
// @stylistic rules (cannot use the recommended config" because it would conflict with the "typescript" config rules)
|
|
125
129
|
"@stylistic/jsx-closing-bracket-location": "warn",
|
|
126
130
|
"@stylistic/jsx-closing-tag-location": "warn",
|
|
@@ -158,8 +162,6 @@ function reactConfig(options = {}) {
|
|
|
158
162
|
"@stylistic/jsx-tag-spacing": [
|
|
159
163
|
"warn",
|
|
160
164
|
{
|
|
161
|
-
// afterOpening: "never",
|
|
162
|
-
// beforeClosing: "never",
|
|
163
165
|
beforeSelfClosing: "always"
|
|
164
166
|
}
|
|
165
167
|
],
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":["webpack://@workleap/eslint-configs/./src/react.ts"],"sourcesContent":["import stylisticPlugin from \"@stylistic/eslint-plugin\";\nimport type { Linter } from \"eslint\";\nimport reactPlugin from \"eslint-plugin-react\";\nimport reactHooksPlugin from \"eslint-plugin-react-hooks\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface ReactConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const reactGlobalIgnores = [];\n\nexport function reactConfig(options: ReactConfigOptions = {}) {\n const {\n rules = {}\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/react\",\n files: [\n \"**/*.[jt]sx\"\n ],\n plugins: {\n \"@stylistic\": stylisticPlugin\n },\n extends: [\n reactPlugin.configs.flat.recommended,\n // @ts-expect-error the typings are broken and think there's a \".default\" to add.\n reactHooksPlugin.configs.flat.recommended\n ],\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true\n }\n }\n },\n settings: {\n react: {\n version: \"detect\"\n }\n },\n rules: {\n // React Recommend rules overrides\n \"react/display-name\": \"off\",\n \"react/jsx-key\": \"off\",\n \"react/jsx-no-duplicate-props\": [\n \"warn\",\n {\n ignoreCase: true\n }\n ],\n \"react/jsx-no-undef\": [\n \"warn\",\n {\n allowGlobals: true\n }\n ],\n \"react/no-unescaped-entities\": \"off\",\n \"react/prop-types\": \"off\",\n \"react/react-in-jsx-scope\": \"off\",\n\n // React extra rules\n \"react/button-has-type\": \"warn\",\n \"react/default-props-match-prop-types\": \"warn\",\n \"react/destructuring-assignment\": [\n \"warn\",\n \"always\",\n { ignoreClassFields: true }\n ],\n \"react/forbid-foreign-prop-types\": [\n \"warn\",\n {\n allowInPropTypes: true\n }\n ],\n \"react/jsx-boolean-value\": [\"warn\", \"never\"],\n \"react/jsx-filename-extension\": [\n \"warn\",\n {\n extensions: [\".jsx\", \".tsx\"]\n }\n ],\n \"react/jsx-pascal-case\": [\n \"warn\",\n {\n allowAllCaps: true,\n ignore: []\n }\n ],\n \"react/no-access-state-in-setstate\": \"warn\",\n \"react/no-array-index-key\": \"warn\",\n \"react/no-typos\": \"error\",\n \"react/no-unused-prop-types\": [\n \"warn\",\n {\n customValidators: [],\n skipShapeProps: true\n }\n ],\n \"react/no-unused-state\": \"warn\",\n \"react/style-prop-object\": \"warn\",\n\n // React rules turned off in favor of @stylistic\n \"react/jsx-closing-bracket-location\": \"off\",\n \"react/jsx-closing-tag-location\": \"off\",\n \"react/jsx-curly-brace-presence\": \"off\",\n \"react/jsx-curly-newline\": \"off\",\n \"react/jsx-curly-spacing\": \"off\",\n \"react/jsx-equals-spacing\": \"off\",\n \"react/jsx-first-prop-new-line\": \"off\",\n \"react/jsx-indent-props\": \"off\",\n \"react/jsx-max-props-per-line\": \"off\",\n \"react/jsx-one-expression-per-line\": \"off\",\n \"react/jsx-tag-spacing\": \"off\",\n \"react/jsx-wrap-multilines\": \"off\",\n\n // @stylistic rules (cannot use the recommended config\" because it would conflict with the \"typescript\" config rules)\n \"@stylistic/jsx-closing-bracket-location\": \"warn\",\n \"@stylistic/jsx-closing-tag-location\": \"warn\",\n \"@stylistic/jsx-curly-brace-presence\": [\n \"warn\",\n {\n propElementValues: \"always\"\n }\n ],\n \"@stylistic/jsx-curly-newline\": \"warn\",\n \"@stylistic/jsx-curly-spacing\": [\n \"warn\",\n {\n children: true,\n when: \"never\"\n }\n ],\n \"@stylistic/jsx-equals-spacing\": \"warn\",\n \"@stylistic/jsx-first-prop-new-line\": \"warn\",\n \"@stylistic/jsx-function-call-newline\": [\"warn\", \"multiline\"],\n \"@stylistic/jsx-max-props-per-line\": [\n \"warn\",\n {\n maximum: 1,\n when: \"multiline\"\n }\n ],\n \"@stylistic/jsx-quotes\": [\"warn\", \"prefer-double\"],\n \"@stylistic/jsx-tag-spacing\": [\n \"warn\",\n {\n
|
|
1
|
+
{"version":3,"file":"react.js","sources":["webpack://@workleap/eslint-configs/./src/react.ts"],"sourcesContent":["import stylisticPlugin from \"@stylistic/eslint-plugin\";\nimport type { Linter } from \"eslint\";\nimport reactPlugin from \"eslint-plugin-react\";\nimport reactHooksPlugin from \"eslint-plugin-react-hooks\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface ReactConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const reactGlobalIgnores = [];\n\nexport function reactConfig(options: ReactConfigOptions = {}) {\n const {\n rules = {}\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/react\",\n files: [\n \"**/*.[jt]sx\"\n ],\n plugins: {\n \"@stylistic\": stylisticPlugin\n },\n extends: [\n reactPlugin.configs.flat.recommended,\n // @ts-expect-error the typings are broken and think there's a \".default\" to add.\n reactHooksPlugin.configs.flat.recommended\n ],\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true\n }\n }\n },\n settings: {\n react: {\n version: \"detect\"\n }\n },\n rules: {\n // React Recommend rules overrides\n \"react/display-name\": \"off\",\n \"react/jsx-key\": \"off\",\n \"react/jsx-no-duplicate-props\": [\n \"warn\",\n {\n ignoreCase: true\n }\n ],\n \"react/jsx-no-undef\": [\n \"warn\",\n {\n allowGlobals: true\n }\n ],\n \"react/no-unescaped-entities\": \"off\",\n \"react/prop-types\": \"off\",\n \"react/react-in-jsx-scope\": \"off\",\n\n // React extra rules\n \"react/button-has-type\": \"warn\",\n \"react/default-props-match-prop-types\": \"warn\",\n \"react/destructuring-assignment\": [\n \"warn\",\n \"always\",\n { ignoreClassFields: true }\n ],\n \"react/forbid-foreign-prop-types\": [\n \"warn\",\n {\n allowInPropTypes: true\n }\n ],\n \"react/jsx-boolean-value\": [\"warn\", \"never\"],\n \"react/jsx-filename-extension\": [\n \"warn\",\n {\n extensions: [\".jsx\", \".tsx\"]\n }\n ],\n \"react/jsx-pascal-case\": [\n \"warn\",\n {\n allowAllCaps: true,\n ignore: []\n }\n ],\n \"react/no-access-state-in-setstate\": \"warn\",\n \"react/no-array-index-key\": \"warn\",\n \"react/no-typos\": \"error\",\n \"react/no-unused-prop-types\": [\n \"warn\",\n {\n customValidators: [],\n skipShapeProps: true\n }\n ],\n \"react/no-unused-state\": \"warn\",\n \"react/style-prop-object\": \"warn\",\n\n // React rules turned off in favor of @stylistic\n \"react/jsx-closing-bracket-location\": \"off\",\n \"react/jsx-closing-tag-location\": \"off\",\n \"react/jsx-curly-brace-presence\": \"off\",\n \"react/jsx-curly-newline\": \"off\",\n \"react/jsx-curly-spacing\": \"off\",\n \"react/jsx-equals-spacing\": \"off\",\n \"react/jsx-first-prop-new-line\": \"off\",\n \"react/jsx-indent-props\": \"off\",\n \"react/jsx-max-props-per-line\": \"off\",\n \"react/jsx-one-expression-per-line\": \"off\",\n \"react/jsx-tag-spacing\": \"off\",\n \"react/jsx-wrap-multilines\": \"off\",\n\n // React Hooks Recommend rules overrides\n \"react-hooks/set-state-in-effect\": \"off\",\n // Should be enabled later when we better understand the rule.\n \"react-hooks/preserve-manual-memoization\": \"off\",\n\n // @stylistic rules (cannot use the recommended config\" because it would conflict with the \"typescript\" config rules)\n \"@stylistic/jsx-closing-bracket-location\": \"warn\",\n \"@stylistic/jsx-closing-tag-location\": \"warn\",\n \"@stylistic/jsx-curly-brace-presence\": [\n \"warn\",\n {\n propElementValues: \"always\"\n }\n ],\n \"@stylistic/jsx-curly-newline\": \"warn\",\n \"@stylistic/jsx-curly-spacing\": [\n \"warn\",\n {\n children: true,\n when: \"never\"\n }\n ],\n \"@stylistic/jsx-equals-spacing\": \"warn\",\n \"@stylistic/jsx-first-prop-new-line\": \"warn\",\n \"@stylistic/jsx-function-call-newline\": [\"warn\", \"multiline\"],\n \"@stylistic/jsx-max-props-per-line\": [\n \"warn\",\n {\n maximum: 1,\n when: \"multiline\"\n }\n ],\n \"@stylistic/jsx-quotes\": [\"warn\", \"prefer-double\"],\n \"@stylistic/jsx-tag-spacing\": [\n \"warn\",\n {\n beforeSelfClosing: \"always\"\n }\n ],\n \"@stylistic/jsx-wrap-multilines\": [\n \"warn\",\n {\n arrow: \"parens-new-line\",\n assignment: \"parens-new-line\",\n condition: \"parens-new-line\",\n declaration: \"parens-new-line\",\n logical: \"parens-new-line\",\n prop: \"parens-new-line\",\n propertyValue: \"parens-new-line\",\n return: \"parens-new-line\"\n }\n ],\n\n // Positioned last to allow the consumer to override any rules.\n ...rules\n }\n }];\n\n return config;\n};\n"],"names":["stylisticPlugin","reactPlugin","reactHooksPlugin","reactGlobalIgnores","reactConfig","options","rules","config"],"mappings":";;;;;;;;;;;AAAuD;AAET;AACW;AAOlD,MAAMG,qBAAqB,EAAE,CAAC;AAE9B,SAASC,YAAYC,UAA8B,CAAC,CAAC;IACxD,MAAM,EACFC,QAAQ,CAAC,CAAC,EACb,GAAGD;IAEJ,MAAME,SAA8B;QAAC;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DAA8D;gBAC9D,2CAA2C;gBAE3C,qHAAqH;gBACrH,2CAA2C;gBAC3C,uCAAuC;gBACvC,uCAAuC;oBACnC;oBACA;wBACI,mBAAmB;oBACvB;iBACH;gBACD,gCAAgC;gBAChC,gCAAgC;oBAC5B;oBACA;wBACI,UAAU;wBACV,MAAM;oBACV;iBACH;gBACD,iCAAiC;gBACjC,sCAAsC;gBACtC,wCAAwC;oBAAC;oBAAQ;iBAAY;gBAC7D,qCAAqC;oBACjC;oBACA;wBACI,SAAS;wBACT,MAAM;oBACV;iBACH;gBACD,yBAAyB;oBAAC;oBAAQ;iBAAgB;gBAClD,8BAA8B;oBAC1B;oBACA;wBACI,mBAAmB;oBACvB;iBACH;gBACD,kCAAkC;oBAC9B;oBACA;wBACI,OAAO;wBACP,YAAY;wBACZ,WAAW;wBACX,aAAa;wBACb,SAAS;wBACT,MAAM;wBACN,eAAe;wBACf,QAAQ;oBACZ;iBACH;gBAED,+DAA+D;gBAC/D,GAAGI,KAAK;YACZ;QACJ;KAAE;IAEF,OAAOC;AACX"}
|
package/dist/typescript.js
CHANGED
|
@@ -86,6 +86,9 @@ function typescriptConfig(tsconfigRootDir, options = {}) {
|
|
|
86
86
|
"@typescript-eslint/only-throw-error": "off",
|
|
87
87
|
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
88
88
|
"@typescript-eslint/restrict-template-expressions": "off",
|
|
89
|
+
// This rule should be enabled but it's strangely causing issues with common React Aria patterns
|
|
90
|
+
// when destructuring an object literal returned by a hook like "useFilter".
|
|
91
|
+
"@typescript-eslint/unbound-method": "off",
|
|
89
92
|
// @stylistic recommend rules overrides
|
|
90
93
|
"@stylistic/arrow-parens": [
|
|
91
94
|
"warn",
|
|
@@ -120,6 +123,41 @@ function typescriptConfig(tsconfigRootDir, options = {}) {
|
|
|
120
123
|
}
|
|
121
124
|
],
|
|
122
125
|
"@stylistic/multiline-ternary": "off",
|
|
126
|
+
"@stylistic/no-mixed-operators": [
|
|
127
|
+
"warn",
|
|
128
|
+
{
|
|
129
|
+
groups: [
|
|
130
|
+
[
|
|
131
|
+
"&",
|
|
132
|
+
"|",
|
|
133
|
+
"^",
|
|
134
|
+
"~",
|
|
135
|
+
"<<",
|
|
136
|
+
">>",
|
|
137
|
+
">>>"
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
"==",
|
|
141
|
+
"!=",
|
|
142
|
+
"===",
|
|
143
|
+
"!==",
|
|
144
|
+
">",
|
|
145
|
+
">=",
|
|
146
|
+
"<",
|
|
147
|
+
"<="
|
|
148
|
+
],
|
|
149
|
+
[
|
|
150
|
+
"&&",
|
|
151
|
+
"||"
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
"in",
|
|
155
|
+
"instanceof"
|
|
156
|
+
]
|
|
157
|
+
],
|
|
158
|
+
allowSamePrecedence: false
|
|
159
|
+
}
|
|
160
|
+
],
|
|
123
161
|
"@stylistic/no-multiple-empty-lines": [
|
|
124
162
|
"warn",
|
|
125
163
|
{
|
package/dist/typescript.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sources":["webpack://@workleap/eslint-configs/./src/typescript.ts"],"sourcesContent":["import js from \"@eslint/js\";\nimport stylisticPlugin from \"@stylistic/eslint-plugin\";\nimport type { Linter } from \"eslint\";\nimport tseslint from \"typescript-eslint\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface TypescriptConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const typescriptGlobalIgnores = [];\n\nexport function typescriptConfig(tsconfigRootDir: string, options: TypescriptConfigOptions = {}) {\n const {\n rules = {}\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/typescript\",\n files: [\n \"**/*.{ts,tsx}\"\n ],\n plugins: {\n \"@stylistic\": stylisticPlugin\n },\n extends: [\n js.configs.recommended,\n tseslint.configs.recommendedTypeChecked,\n tseslint.configs.stylisticTypeCheckedOnly,\n stylisticPlugin.configs.customize({\n braceStyle: \"1tbs\",\n commaDangle: \"never\",\n jsx: false,\n quotes: \"double\",\n semi: true,\n severity: \"warn\"\n })\n ],\n languageOptions: {\n parser: tseslint.parser,\n parserOptions: {\n // Rely on TypeScript's project service to automatically discover the \"tsconfig.json\" file\n // within the boundaries of \"tsconfigRootDir\".\n projectService: true,\n tsconfigRootDir\n }\n },\n rules: {\n // ESLint core rules overrides\n \"dot-notation\": \"off\",\n \"indent\": \"off\",\n \"no-dupe-class-members\": \"off\",\n \"no-empty-function\": \"off\",\n \"no-loop-func\": \"off\",\n \"no-shadow\": \"off\",\n \"no-unused-expressions\": \"off\",\n \"no-use-before-define\": \"off\",\n \"no-useless-constructor\": \"off\",\n \"object-curly-spacing\": \"off\",\n \"quotes\": \"off\",\n \"semi\": \"off\",\n\n // ESlint deprecated core rules\n \"arrow-parens\": \"off\",\n \"comma-dangle\": \"off\",\n\n // @typescript-eslint recommended rules overrides\n \"@typescript-eslint/dot-notation\": \"off\",\n \"@typescript-eslint/no-base-to-string\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-object-type\": [\n \"error\",\n {\n allowInterfaces: \"with-single-extends\",\n allowObjectTypes: \"never\"\n }\n ],\n \"@typescript-eslint/no-floating-promises\": \"off\",\n // This rule should be enabled but has several options that need to be investigated.\n \"@typescript-eslint/no-misused-promises\": \"off\",\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n \"@typescript-eslint/no-unsafe-argument\": \"off\",\n \"@typescript-eslint/no-unsafe-assignment\": \"off\",\n \"@typescript-eslint/no-unsafe-call\": \"off\",\n \"@typescript-eslint/no-unsafe-member-access\": \"off\",\n \"@typescript-eslint/no-unsafe-return\": \"off\",\n \"@typescript-eslint/only-throw-error\": \"off\",\n \"@typescript-eslint/prefer-nullish-coalescing\": \"off\",\n \"@typescript-eslint/restrict-template-expressions\": \"off\",\n\n // @stylistic recommend rules overrides\n \"@stylistic/arrow-parens\": [\n \"warn\",\n \"as-needed\",\n {\n requireForBlockBody: false\n }\n ],\n \"@stylistic/indent\": [\n \"warn\",\n 4,\n {\n SwitchCase: 1,\n CallExpression: { arguments: \"first\" }\n }\n ],\n \"@stylistic/indent-binary-ops\": [\"warn\", 4],\n \"@stylistic/member-delimiter-style\": [\n \"warn\",\n {\n multiline: {\n delimiter: \"semi\"\n },\n singleline: {\n delimiter: \"semi\"\n }\n }\n ],\n \"@stylistic/multiline-ternary\": \"off\",\n \"@stylistic/no-multiple-empty-lines\": [\n \"warn\",\n {\n // View https://eslint.style/rules/eol-last.\n max: 1\n }\n ],\n \"@stylistic/operator-linebreak\": \"off\",\n \"@stylistic/spaced-comment\": \"off\",\n // Should be the default but somehow it's not enforced if it's not explicitly specified.\n \"@stylistic/quote-props\": \"off\",\n\n // Positioned last to allow the consumer to override any rules.\n ...rules\n }\n }];\n\n return config;\n};\n"],"names":["js","stylisticPlugin","tseslint","typescriptGlobalIgnores","typescriptConfig","tsconfigRootDir","options","rules","config"],"mappings":";;;;;;;;;;;AAA4B;AAC2B;AAEd;AAOlC,MAAMG,0BAA0B,EAAE,CAAC;AAEnC,SAASC,iBAAiBC,eAAuB,EAAEC,UAAmC,CAAC,CAAC;IAC3F,MAAM,EACFC,QAAQ,CAAC,CAAC,EACb,GAAGD;IAEJ,MAAME,SAA8B;QAAC;YACjC,MAAM;YACN,OAAO;gBACH;aACH;YACD,SAAS;gBACL,cAAcP,aAAeA;YACjC;YACA,SAAS;gBACLD,sBAAsB;gBACtBE,gDAAuC;gBACvCA,kDAAyC;gBACzCD,+BAAiC,CAAC;oBAC9B,YAAY;oBACZ,aAAa;oBACb,KAAK;oBACL,QAAQ;oBACR,MAAM;oBACN,UAAU;gBACd;aACH;YACD,iBAAiB;gBACb,QAAQC,wBAAe;gBACvB,eAAe;oBACX,0FAA0F;oBAC1F,8CAA8C;oBAC9C,gBAAgB;oBAChBG;gBACJ;YACJ;YACA,OAAO;gBACH,8BAA8B;gBAC9B,gBAAgB;gBAChB,UAAU;gBACV,yBAAyB;gBACzB,qBAAqB;gBACrB,gBAAgB;gBAChB,aAAa;gBACb,yBAAyB;gBACzB,wBAAwB;gBACxB,0BAA0B;gBAC1B,wBAAwB;gBACxB,UAAU;gBACV,QAAQ;gBAER,+BAA+B;gBAC/B,gBAAgB;gBAChB,gBAAgB;gBAEhB,iDAAiD;gBACjD,mCAAmC;gBACnC,wCAAwC;gBACxC,wCAAwC;gBACxC,2CAA2C;oBACvC;oBACA;wBACI,iBAAiB;wBACjB,kBAAkB;oBACtB;iBACH;gBACD,2CAA2C;gBAC3C,oFAAoF;gBACpF,0CAA0C;gBAC1C,4CAA4C;gBAC5C,yCAAyC;gBACzC,2CAA2C;gBAC3C,qCAAqC;gBACrC,8CAA8C;gBAC9C,uCAAuC;gBACvC,uCAAuC;gBACvC,gDAAgD;gBAChD,oDAAoD;
|
|
1
|
+
{"version":3,"file":"typescript.js","sources":["webpack://@workleap/eslint-configs/./src/typescript.ts"],"sourcesContent":["import js from \"@eslint/js\";\nimport stylisticPlugin from \"@stylistic/eslint-plugin\";\nimport type { Linter } from \"eslint\";\nimport tseslint from \"typescript-eslint\";\nimport type { ConfigWithExtends } from \"./types.ts\";\n\nexport interface TypescriptConfigOptions {\n rules?: Partial<Linter.RulesRecord>;\n}\n\nexport const typescriptGlobalIgnores = [];\n\nexport function typescriptConfig(tsconfigRootDir: string, options: TypescriptConfigOptions = {}) {\n const {\n rules = {}\n } = options;\n\n const config: ConfigWithExtends[] = [{\n name: \"@workleap/eslint-configs/typescript\",\n files: [\n \"**/*.{ts,tsx}\"\n ],\n plugins: {\n \"@stylistic\": stylisticPlugin\n },\n extends: [\n js.configs.recommended,\n tseslint.configs.recommendedTypeChecked,\n tseslint.configs.stylisticTypeCheckedOnly,\n stylisticPlugin.configs.customize({\n braceStyle: \"1tbs\",\n commaDangle: \"never\",\n jsx: false,\n quotes: \"double\",\n semi: true,\n severity: \"warn\"\n })\n ],\n languageOptions: {\n parser: tseslint.parser,\n parserOptions: {\n // Rely on TypeScript's project service to automatically discover the \"tsconfig.json\" file\n // within the boundaries of \"tsconfigRootDir\".\n projectService: true,\n tsconfigRootDir\n }\n },\n rules: {\n // ESLint core rules overrides\n \"dot-notation\": \"off\",\n \"indent\": \"off\",\n \"no-dupe-class-members\": \"off\",\n \"no-empty-function\": \"off\",\n \"no-loop-func\": \"off\",\n \"no-shadow\": \"off\",\n \"no-unused-expressions\": \"off\",\n \"no-use-before-define\": \"off\",\n \"no-useless-constructor\": \"off\",\n \"object-curly-spacing\": \"off\",\n \"quotes\": \"off\",\n \"semi\": \"off\",\n\n // ESlint deprecated core rules\n \"arrow-parens\": \"off\",\n \"comma-dangle\": \"off\",\n\n // @typescript-eslint recommended rules overrides\n \"@typescript-eslint/dot-notation\": \"off\",\n \"@typescript-eslint/no-base-to-string\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-object-type\": [\n \"error\",\n {\n allowInterfaces: \"with-single-extends\",\n allowObjectTypes: \"never\"\n }\n ],\n \"@typescript-eslint/no-floating-promises\": \"off\",\n // This rule should be enabled but has several options that need to be investigated.\n \"@typescript-eslint/no-misused-promises\": \"off\",\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n \"@typescript-eslint/no-unsafe-argument\": \"off\",\n \"@typescript-eslint/no-unsafe-assignment\": \"off\",\n \"@typescript-eslint/no-unsafe-call\": \"off\",\n \"@typescript-eslint/no-unsafe-member-access\": \"off\",\n \"@typescript-eslint/no-unsafe-return\": \"off\",\n \"@typescript-eslint/only-throw-error\": \"off\",\n \"@typescript-eslint/prefer-nullish-coalescing\": \"off\",\n \"@typescript-eslint/restrict-template-expressions\": \"off\",\n // This rule should be enabled but it's strangely causing issues with common React Aria patterns\n // when destructuring an object literal returned by a hook like \"useFilter\".\n \"@typescript-eslint/unbound-method\": \"off\",\n\n // @stylistic recommend rules overrides\n \"@stylistic/arrow-parens\": [\n \"warn\",\n \"as-needed\",\n {\n requireForBlockBody: false\n }\n ],\n \"@stylistic/indent\": [\n \"warn\",\n 4,\n {\n SwitchCase: 1,\n CallExpression: { arguments: \"first\" }\n }\n ],\n \"@stylistic/indent-binary-ops\": [\"warn\", 4],\n \"@stylistic/member-delimiter-style\": [\n \"warn\",\n {\n multiline: {\n delimiter: \"semi\"\n },\n singleline: {\n delimiter: \"semi\"\n }\n }\n ],\n \"@stylistic/multiline-ternary\": \"off\",\n \"@stylistic/no-mixed-operators\": [\n \"warn\",\n {\n groups: [\n [\"&\", \"|\", \"^\", \"~\", \"<<\", \">>\", \">>>\"],\n [\"==\", \"!=\", \"===\", \"!==\", \">\", \">=\", \"<\", \"<=\"],\n [\"&&\", \"||\"],\n [\"in\", \"instanceof\"]\n ],\n allowSamePrecedence: false\n }\n ],\n \"@stylistic/no-multiple-empty-lines\": [\n \"warn\",\n {\n // View https://eslint.style/rules/eol-last.\n max: 1\n }\n ],\n \"@stylistic/operator-linebreak\": \"off\",\n \"@stylistic/spaced-comment\": \"off\",\n // Should be the default but somehow it's not enforced if it's not explicitly specified.\n \"@stylistic/quote-props\": \"off\",\n\n // Positioned last to allow the consumer to override any rules.\n ...rules\n }\n }];\n\n return config;\n};\n"],"names":["js","stylisticPlugin","tseslint","typescriptGlobalIgnores","typescriptConfig","tsconfigRootDir","options","rules","config"],"mappings":";;;;;;;;;;;AAA4B;AAC2B;AAEd;AAOlC,MAAMG,0BAA0B,EAAE,CAAC;AAEnC,SAASC,iBAAiBC,eAAuB,EAAEC,UAAmC,CAAC,CAAC;IAC3F,MAAM,EACFC,QAAQ,CAAC,CAAC,EACb,GAAGD;IAEJ,MAAME,SAA8B;QAAC;YACjC,MAAM;YACN,OAAO;gBACH;aACH;YACD,SAAS;gBACL,cAAcP,aAAeA;YACjC;YACA,SAAS;gBACLD,sBAAsB;gBACtBE,gDAAuC;gBACvCA,kDAAyC;gBACzCD,+BAAiC,CAAC;oBAC9B,YAAY;oBACZ,aAAa;oBACb,KAAK;oBACL,QAAQ;oBACR,MAAM;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;gCAAO;gCAAO;gCAAK;gCAAM;gCAAK;6BAAK;4BAChD;gCAAC;gCAAM;6BAAK;4BACZ;gCAAC;gCAAM;6BAAa;yBACvB;wBACD,qBAAqB;oBACzB;iBACH;gBACD,sCAAsC;oBAClC;oBACA;wBACI,4CAA4C;wBAC5C,KAAK;oBACT;iBACH;gBACD,iCAAiC;gBACjC,6BAA6B;gBAC7B,wFAAwF;gBACxF,0BAA0B;gBAE1B,+DAA+D;gBAC/D,GAAGE,KAAK;YACZ;QACJ;KAAE;IAEF,OAAOC;AACX"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@workleap/eslint-configs",
|
|
3
3
|
"author": "Workleap",
|
|
4
4
|
"description": "Workleap recommended ESLint configurations.",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.7",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"build": "rslib build -c rslib.config.ts",
|
|
80
|
-
"eslint": "eslint . --max-warnings
|
|
80
|
+
"eslint": "eslint . --max-warnings=0 --cache --cache-location node_modules/.cache/eslint",
|
|
81
81
|
"typecheck": "tsc"
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -45,6 +45,28 @@ error Parsing error: C:\Dev\workleap\wl-web-configs\samples\storybook\rsbuild\.
|
|
|
45
45
|
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
|
+
/*
|
|
49
|
+
|
|
50
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
51
|
+
import { defineReactLibraryConfig } from "@workleap/eslint-configs";
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores([
|
|
55
|
+
"/reports/**"
|
|
56
|
+
]),
|
|
57
|
+
defineReactLibraryConfig(import.meta.dirname)
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
|
|
64
|
+
The key insight was that ESLint 9's flat config system requires ignores to be specified in the configuration
|
|
65
|
+
file itself for optimal performance, rather than relying on CLI flags (--ignore-pattern). The ignores array at the beginning of the
|
|
66
|
+
config ensures files are filtered out during the file discovery phase, not after.
|
|
67
|
+
|
|
68
|
+
*/
|
|
69
|
+
|
|
48
70
|
export interface DefineWebApplicationConfigOptions {
|
|
49
71
|
core?: CoreConfigOptions;
|
|
50
72
|
jest?: JestConfigOptions;
|
package/src/core.ts
CHANGED
|
@@ -70,21 +70,10 @@ export function coreConfig(options: CoreConfigOptions = {}) {
|
|
|
70
70
|
"no-label-var": "warn",
|
|
71
71
|
"no-lone-blocks": "warn",
|
|
72
72
|
"no-loop-func": "warn",
|
|
73
|
-
"no-mixed-operators": [
|
|
74
|
-
"warn",
|
|
75
|
-
{
|
|
76
|
-
groups: [
|
|
77
|
-
["&", "|", "^", "~", "<<", ">>", ">>>"],
|
|
78
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
79
|
-
["&&", "||"],
|
|
80
|
-
["in", "instanceof"]
|
|
81
|
-
],
|
|
82
|
-
allowSamePrecedence: false
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
73
|
"no-multi-str": "warn",
|
|
86
74
|
"no-new-func": "warn",
|
|
87
|
-
|
|
75
|
+
// Deprecated but still no replacement in @stylistic.
|
|
76
|
+
// "no-new-object": "warn",
|
|
88
77
|
"no-new-wrappers": "warn",
|
|
89
78
|
"no-octal-escape": "warn",
|
|
90
79
|
"no-param-reassign": "warn",
|
package/src/react.ts
CHANGED
|
@@ -115,6 +115,11 @@ export function reactConfig(options: ReactConfigOptions = {}) {
|
|
|
115
115
|
"react/jsx-tag-spacing": "off",
|
|
116
116
|
"react/jsx-wrap-multilines": "off",
|
|
117
117
|
|
|
118
|
+
// React Hooks Recommend rules overrides
|
|
119
|
+
"react-hooks/set-state-in-effect": "off",
|
|
120
|
+
// Should be enabled later when we better understand the rule.
|
|
121
|
+
"react-hooks/preserve-manual-memoization": "off",
|
|
122
|
+
|
|
118
123
|
// @stylistic rules (cannot use the recommended config" because it would conflict with the "typescript" config rules)
|
|
119
124
|
"@stylistic/jsx-closing-bracket-location": "warn",
|
|
120
125
|
"@stylistic/jsx-closing-tag-location": "warn",
|
|
@@ -146,10 +151,7 @@ export function reactConfig(options: ReactConfigOptions = {}) {
|
|
|
146
151
|
"@stylistic/jsx-tag-spacing": [
|
|
147
152
|
"warn",
|
|
148
153
|
{
|
|
149
|
-
// afterOpening: "never",
|
|
150
|
-
// beforeClosing: "never",
|
|
151
154
|
beforeSelfClosing: "always"
|
|
152
|
-
// closingSlash: "never"
|
|
153
155
|
}
|
|
154
156
|
],
|
|
155
157
|
"@stylistic/jsx-wrap-multilines": [
|
package/src/typescript.ts
CHANGED
|
@@ -87,6 +87,9 @@ export function typescriptConfig(tsconfigRootDir: string, options: TypescriptCon
|
|
|
87
87
|
"@typescript-eslint/only-throw-error": "off",
|
|
88
88
|
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
89
89
|
"@typescript-eslint/restrict-template-expressions": "off",
|
|
90
|
+
// This rule should be enabled but it's strangely causing issues with common React Aria patterns
|
|
91
|
+
// when destructuring an object literal returned by a hook like "useFilter".
|
|
92
|
+
"@typescript-eslint/unbound-method": "off",
|
|
90
93
|
|
|
91
94
|
// @stylistic recommend rules overrides
|
|
92
95
|
"@stylistic/arrow-parens": [
|
|
@@ -117,6 +120,18 @@ export function typescriptConfig(tsconfigRootDir: string, options: TypescriptCon
|
|
|
117
120
|
}
|
|
118
121
|
],
|
|
119
122
|
"@stylistic/multiline-ternary": "off",
|
|
123
|
+
"@stylistic/no-mixed-operators": [
|
|
124
|
+
"warn",
|
|
125
|
+
{
|
|
126
|
+
groups: [
|
|
127
|
+
["&", "|", "^", "~", "<<", ">>", ">>>"],
|
|
128
|
+
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
129
|
+
["&&", "||"],
|
|
130
|
+
["in", "instanceof"]
|
|
131
|
+
],
|
|
132
|
+
allowSamePrecedence: false
|
|
133
|
+
}
|
|
134
|
+
],
|
|
120
135
|
"@stylistic/no-multiple-empty-lines": [
|
|
121
136
|
"warn",
|
|
122
137
|
{
|