@workleap/eslint-configs 0.0.6 → 0.0.8

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @workleap/eslint-configs
2
2
 
3
+ ## 0.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#313](https://github.com/workleap/wl-web-configs/pull/313) [`d7f37fe`](https://github.com/workleap/wl-web-configs/commit/d7f37fe8e6db5d4f360fc7ea49ec302fd9779b00) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added a `compiler` option to the React rules.
8
+
9
+ ## 0.0.7
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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
14
+
3
15
  ## 0.0.6
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\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"}
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\n/*\n\nDocument the React compiler setting\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;AA6EnF;;;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/react.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { Linter } from "eslint";
2
2
  import type { ConfigWithExtends } from "./types.ts";
3
3
  export interface ReactConfigOptions {
4
4
  rules?: Partial<Linter.RulesRecord>;
5
+ compiler?: boolean;
5
6
  }
6
7
  export declare const reactGlobalIgnores: never[];
7
8
  export declare function reactConfig(options?: ReactConfigOptions): ConfigWithExtends[];
package/dist/react.js CHANGED
@@ -14,7 +14,7 @@ import eslint_plugin_react_hooks from "eslint-plugin-react-hooks";
14
14
 
15
15
  const reactGlobalIgnores = [];
16
16
  function reactConfig(options = {}) {
17
- const { rules = {} } = options;
17
+ const { rules = {}, compiler = false } = options;
18
18
  const config = [
19
19
  {
20
20
  name: "@workleap/eslint-configs/react",
@@ -42,7 +42,7 @@ function reactConfig(options = {}) {
42
42
  }
43
43
  },
44
44
  rules: {
45
- // React Recommend rules overrides
45
+ // React recommend rules overrides
46
46
  "react/display-name": "off",
47
47
  "react/jsx-key": "off",
48
48
  "react/jsx-no-duplicate-props": [
@@ -121,6 +121,15 @@ 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
+ // React hooks "compiler" related rules
127
+ ...compiler === false ? {
128
+ "react-hooks/gating": "off",
129
+ "react-hooks/incompatible-library": "off",
130
+ "react-hooks/preserve-manual-memoization": "off",
131
+ "react-hooks/unsupported-syntax": "off"
132
+ } : {},
124
133
  // @stylistic rules (cannot use the recommended config" because it would conflict with the "typescript" config rules)
125
134
  "@stylistic/jsx-closing-bracket-location": "warn",
126
135
  "@stylistic/jsx-closing-tag-location": "warn",
@@ -158,8 +167,6 @@ function reactConfig(options = {}) {
158
167
  "@stylistic/jsx-tag-spacing": [
159
168
  "warn",
160
169
  {
161
- // afterOpening: "never",
162
- // beforeClosing: "never",
163
170
  beforeSelfClosing: "always"
164
171
  }
165
172
  ],
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 // afterOpening: \"never\",\n // beforeClosing: \"never\",\n beforeSelfClosing: \"always\"\n // closingSlash: \"never\"\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;YACjC,MAAM;YACN,OAAO;gBACH;aACH;YACD,SAAS;gBACL,cAAcP,aAAeA;YACjC;YACA,SAAS;gBACLC,4CAAoC;gBACpC,iFAAiF;gBACjFC,kDAAyC;aAC5C;YACD,iBAAiB;gBACb,eAAe;oBACX,cAAc;wBACV,KAAK;oBACT;gBACJ;YACJ;YACA,UAAU;gBACN,OAAO;oBACH,SAAS;gBACb;YACJ;YACA,OAAO;gBACH,kCAAkC;gBAClC,sBAAsB;gBACtB,iBAAiB;gBACjB,gCAAgC;oBAC5B;oBACA;wBACI,YAAY;oBAChB;iBACH;gBACD,sBAAsB;oBAClB;oBACA;wBACI,cAAc;oBAClB;iBACH;gBACD,+BAA+B;gBAC/B,oBAAoB;gBACpB,4BAA4B;gBAE5B,oBAAoB;gBACpB,yBAAyB;gBACzB,wCAAwC;gBACxC,kCAAkC;oBAC9B;oBACA;oBACA;wBAAE,mBAAmB;oBAAK;iBAC7B;gBACD,mCAAmC;oBAC/B;oBACA;wBACI,kBAAkB;oBACtB;iBACH;gBACD,2BAA2B;oBAAC;oBAAQ;iBAAQ;gBAC5C,gCAAgC;oBAC5B;oBACA;wBACI,YAAY;4BAAC;4BAAQ;yBAAO;oBAChC;iBACH;gBACD,yBAAyB;oBACrB;oBACA;wBACI,cAAc;wBACd,QAAQ,EAAE;oBACd;iBACH;gBACD,qCAAqC;gBACrC,4BAA4B;gBAC5B,kBAAkB;gBAClB,8BAA8B;oBAC1B;oBACA;wBACI,kBAAkB,EAAE;wBACpB,gBAAgB;oBACpB;iBACH;gBACD,yBAAyB;gBACzB,2BAA2B;gBAE3B,gDAAgD;gBAChD,sCAAsC;gBACtC,kCAAkC;gBAClC,kCAAkC;gBAClC,2BAA2B;gBAC3B,2BAA2B;gBAC3B,4BAA4B;gBAC5B,iCAAiC;gBACjC,0BAA0B;gBAC1B,gCAAgC;gBAChC,qCAAqC;gBACrC,yBAAyB;gBACzB,6BAA6B;gBAE7B,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,yBAAyB;wBACzB,0BAA0B;wBAC1B,mBAAmB;oBAEvB;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"}
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 compiler?: boolean;\n}\n\nexport const reactGlobalIgnores = [];\n\nexport function reactConfig(options: ReactConfigOptions = {}) {\n const {\n rules = {},\n compiler = false\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\n // React hooks \"compiler\" related rules\n ...compiler === false ? {\n \"react-hooks/gating\": \"off\",\n \"react-hooks/incompatible-library\": \"off\",\n \"react-hooks/preserve-manual-memoization\": \"off\",\n \"react-hooks/unsupported-syntax\": \"off\"\n } : {},\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","compiler","config"],"mappings":";;;;;;;;;;;AAAuD;AAET;AACW;AAQlD,MAAMG,qBAAqB,EAAE,CAAC;AAE9B,SAASC,YAAYC,UAA8B,CAAC,CAAC;IACxD,MAAM,EACFC,QAAQ,CAAC,CAAC,EACVC,WAAW,KAAK,EACnB,GAAGF;IAEJ,MAAMG,SAA8B;QAAC;YACjC,MAAM;YACN,OAAO;gBACH;aACH;YACD,SAAS;gBACL,cAAcR,aAAeA;YACjC;YACA,SAAS;gBACLC,4CAAoC;gBACpC,iFAAiF;gBACjFC,kDAAyC;aAC5C;YACD,iBAAiB;gBACb,eAAe;oBACX,cAAc;wBACV,KAAK;oBACT;gBACJ;YACJ;YACA,UAAU;gBACN,OAAO;oBACH,SAAS;gBACb;YACJ;YACA,OAAO;gBACH,kCAAkC;gBAClC,sBAAsB;gBACtB,iBAAiB;gBACjB,gCAAgC;oBAC5B;oBACA;wBACI,YAAY;oBAChB;iBACH;gBACD,sBAAsB;oBAClB;oBACA;wBACI,cAAc;oBAClB;iBACH;gBACD,+BAA+B;gBAC/B,oBAAoB;gBACpB,4BAA4B;gBAE5B,oBAAoB;gBACpB,yBAAyB;gBACzB,wCAAwC;gBACxC,kCAAkC;oBAC9B;oBACA;oBACA;wBAAE,mBAAmB;oBAAK;iBAC7B;gBACD,mCAAmC;oBAC/B;oBACA;wBACI,kBAAkB;oBACtB;iBACH;gBACD,2BAA2B;oBAAC;oBAAQ;iBAAQ;gBAC5C,gCAAgC;oBAC5B;oBACA;wBACI,YAAY;4BAAC;4BAAQ;yBAAO;oBAChC;iBACH;gBACD,yBAAyB;oBACrB;oBACA;wBACI,cAAc;wBACd,QAAQ,EAAE;oBACd;iBACH;gBACD,qCAAqC;gBACrC,4BAA4B;gBAC5B,kBAAkB;gBAClB,8BAA8B;oBAC1B;oBACA;wBACI,kBAAkB,EAAE;wBACpB,gBAAgB;oBACpB;iBACH;gBACD,yBAAyB;gBACzB,2BAA2B;gBAE3B,gDAAgD;gBAChD,sCAAsC;gBACtC,kCAAkC;gBAClC,kCAAkC;gBAClC,2BAA2B;gBAC3B,2BAA2B;gBAC3B,4BAA4B;gBAC5B,iCAAiC;gBACjC,0BAA0B;gBAC1B,gCAAgC;gBAChC,qCAAqC;gBACrC,yBAAyB;gBACzB,6BAA6B;gBAE7B,wCAAwC;gBACxC,mCAAmC;gBAEnC,uCAAuC;gBACvC,GAAGK,aAAa,QAAQ;oBACpB,sBAAsB;oBACtB,oCAAoC;oBACpC,2CAA2C;oBAC3C,kCAAkC;gBACtC,IAAI,CAAC,CAAC;gBAEN,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,GAAGD,KAAK;YACZ;QACJ;KAAE;IAEF,OAAOE;AACX"}
@@ -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",
@@ -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-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;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;gBAEpD,uCAAuC;gBACvC,2BAA2B;oBACvB;oBACA;oBACA;wBACI,qBAAqB;oBACzB;iBACH;gBACD,qBAAqB;oBACjB;oBACA;oBACA;wBACI,YAAY;wBACZ,gBAAgB;4BAAE,WAAW;wBAAQ;oBACzC;iBACH;gBACD,gCAAgC;oBAAC;oBAAQ;iBAAE;gBAC3C,qCAAqC;oBACjC;oBACA;wBACI,WAAW;4BACP,WAAW;wBACf;wBACA,YAAY;4BACR,WAAW;wBACf;oBACJ;iBACH;gBACD,gCAAgC;gBAChC,iCAAiC;oBAC7B;oBACA;wBACI,QAAQ;4BACJ;gCAAC;gCAAK;gCAAK;gCAAK;gCAAK;gCAAM;gCAAM;6BAAM;4BACvC;gCAAC;gCAAM;gCAAM;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"}
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;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;gBACpD,gGAAgG;gBAChG,4EAA4E;gBAC5E,qCAAqC;gBAErC,uCAAuC;gBACvC,2BAA2B;oBACvB;oBACA;oBACA;wBACI,qBAAqB;oBACzB;iBACH;gBACD,qBAAqB;oBACjB;oBACA;oBACA;wBACI,YAAY;wBACZ,gBAAgB;4BAAE,WAAW;wBAAQ;oBACzC;iBACH;gBACD,gCAAgC;oBAAC;oBAAQ;iBAAE;gBAC3C,qCAAqC;oBACjC;oBACA;wBACI,WAAW;4BACP,WAAW;wBACf;wBACA,YAAY;4BACR,WAAW;wBACf;oBACJ;iBACH;gBACD,gCAAgC;gBAChC,iCAAiC;oBAC7B;oBACA;wBACI,QAAQ;4BACJ;gCAAC;gCAAK;gCAAK;gCAAK;gCAAK;gCAAM;gCAAM;6BAAM;4BACvC;gCAAC;gCAAM;gCAAM;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.6",
5
+ "version": "0.0.8",
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=-0 --cache --cache-location node_modules/.cache/eslint",
80
+ "eslint": "eslint . --max-warnings=0 --cache --cache-location node_modules/.cache/eslint",
81
81
  "typecheck": "tsc"
82
82
  }
83
83
  }
@@ -67,6 +67,12 @@ file itself for optimal performance, rather than relying on CLI flags (--ignore-
67
67
 
68
68
  */
69
69
 
70
+ /*
71
+
72
+ Document the React compiler setting
73
+
74
+ */
75
+
70
76
  export interface DefineWebApplicationConfigOptions {
71
77
  core?: CoreConfigOptions;
72
78
  jest?: JestConfigOptions;
package/src/react.ts CHANGED
@@ -6,13 +6,15 @@ import type { ConfigWithExtends } from "./types.ts";
6
6
 
7
7
  export interface ReactConfigOptions {
8
8
  rules?: Partial<Linter.RulesRecord>;
9
+ compiler?: boolean;
9
10
  }
10
11
 
11
12
  export const reactGlobalIgnores = [];
12
13
 
13
14
  export function reactConfig(options: ReactConfigOptions = {}) {
14
15
  const {
15
- rules = {}
16
+ rules = {},
17
+ compiler = false
16
18
  } = options;
17
19
 
18
20
  const config: ConfigWithExtends[] = [{
@@ -41,7 +43,7 @@ export function reactConfig(options: ReactConfigOptions = {}) {
41
43
  }
42
44
  },
43
45
  rules: {
44
- // React Recommend rules overrides
46
+ // React recommend rules overrides
45
47
  "react/display-name": "off",
46
48
  "react/jsx-key": "off",
47
49
  "react/jsx-no-duplicate-props": [
@@ -115,6 +117,17 @@ export function reactConfig(options: ReactConfigOptions = {}) {
115
117
  "react/jsx-tag-spacing": "off",
116
118
  "react/jsx-wrap-multilines": "off",
117
119
 
120
+ // React hooks recommend rules overrides
121
+ "react-hooks/set-state-in-effect": "off",
122
+
123
+ // React hooks "compiler" related rules
124
+ ...compiler === false ? {
125
+ "react-hooks/gating": "off",
126
+ "react-hooks/incompatible-library": "off",
127
+ "react-hooks/preserve-manual-memoization": "off",
128
+ "react-hooks/unsupported-syntax": "off"
129
+ } : {},
130
+
118
131
  // @stylistic rules (cannot use the recommended config" because it would conflict with the "typescript" config rules)
119
132
  "@stylistic/jsx-closing-bracket-location": "warn",
120
133
  "@stylistic/jsx-closing-tag-location": "warn",
@@ -146,10 +159,7 @@ export function reactConfig(options: ReactConfigOptions = {}) {
146
159
  "@stylistic/jsx-tag-spacing": [
147
160
  "warn",
148
161
  {
149
- // afterOpening: "never",
150
- // beforeClosing: "never",
151
162
  beforeSelfClosing: "always"
152
- // closingSlash: "never"
153
163
  }
154
164
  ],
155
165
  "@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": [