@nighttrax/eslint-config-tsx 12.0.0-beta.5 → 12.0.0-beta.6

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/react.mjs +55 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nighttrax/eslint-config-tsx",
3
- "version": "12.0.0-beta.5",
3
+ "version": "12.0.0-beta.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,7 +25,7 @@
25
25
  "eslint-plugin-jsx-a11y": "~6.10.2",
26
26
  "eslint-plugin-react": "~7.37.5",
27
27
  "eslint-plugin-react-hooks": "~5.2.0",
28
- "@nighttrax/eslint-config-ts": "12.0.0-beta.5"
28
+ "@nighttrax/eslint-config-ts": "12.0.0-beta.6"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "eslint": "^9.0.0"
package/src/react.mjs CHANGED
@@ -1,37 +1,65 @@
1
1
  import react from "eslint-plugin-react";
2
2
  import jsxA11y from "eslint-plugin-jsx-a11y";
3
3
  import * as reactHooks from "eslint-plugin-react-hooks";
4
- import { nighttraxTS } from "@nighttrax/eslint-config-ts";
4
+ import { EXTENSIONS, nighttraxTS } from "@nighttrax/eslint-config-ts";
5
5
 
6
6
  /**
7
- * @param {import('typescript-eslint').InfiniteDepthConfigWithExtends[]} configs
7
+ * @param {import('typescript-eslint').InfiniteDepthConfigWithExtends[]} [configs]
8
+ *
9
+ * @param {object} opts
10
+ * @param {string[]} [opts.ignores] A list of globs that will be ignored.
11
+ * @param {string[]} [opts.devDeps] A list of globs that will be matched for
12
+ * the `import-x/no-extraneous-dependencies` rule's `devDependencies` option.
13
+ * @param {string} [opts.version] React version, defaults to "detect".
8
14
  */
9
- export const nighttraxReact = (...configs) =>
10
- nighttraxTS([
11
- react.configs.flat.recommended,
12
- react.configs.flat["jsx-runtime"],
13
- reactHooks.configs["recommended-latest"],
14
- jsxA11y.flatConfigs.recommended,
15
+ export const nighttraxReact = (
16
+ configs = [],
17
+ { devDeps = [], ignores: ignores = [], version = "detect" } = {},
18
+ ) =>
19
+ nighttraxTS(
20
+ [
21
+ react.configs.flat.recommended,
22
+ react.configs.flat["jsx-runtime"],
23
+ reactHooks.configs["recommended-latest"],
24
+ jsxA11y["flatConfigs"].recommended,
15
25
 
16
- {
17
- settings: {
18
- react: {
19
- version: "detect",
20
- },
21
- },
22
- rules: {
23
- // This usually warns for memoized or forwardRef-ed components, which is fine.
24
- "react/display-name": "off",
25
- "react/function-component-definition": [
26
- "error",
27
- {
28
- namedComponents: "arrow-function",
29
- unnamedComponents: "arrow-function",
26
+ {
27
+ settings: {
28
+ react: {
29
+ version,
30
30
  },
31
- ],
32
- "react/jsx-no-leaked-render": "error",
31
+ },
32
+ rules: {
33
+ // This usually warns for memoized or forwardRef-ed components, which is fine.
34
+ "react/display-name": "off",
35
+ "react/function-component-definition": [
36
+ "error",
37
+ {
38
+ namedComponents: "arrow-function",
39
+ unnamedComponents: "arrow-function",
40
+ },
41
+ ],
42
+ "react/jsx-no-leaked-render": "error",
43
+ "react/jsx-boolean-value": ["error", "never"],
44
+ "react/forward-ref-uses-ref": "error",
45
+ "react/jsx-no-useless-fragment": "error",
46
+ "react/jsx-fragments": "error",
47
+ "react/jsx-curly-brace-presence": "error",
48
+ },
33
49
  },
34
- },
35
50
 
36
- ...configs,
37
- ]);
51
+ ...configs,
52
+ ],
53
+ {
54
+ ignores,
55
+ devDeps: [
56
+ `**/.storybook/main.${EXTENSIONS}`,
57
+ `**/.storybook/preview.${EXTENSIONS}`,
58
+ `**/*.stories.${EXTENSIONS}`,
59
+ `metro.config.${EXTENSIONS}`,
60
+ `app.config.${EXTENSIONS}`,
61
+
62
+ ...devDeps,
63
+ ],
64
+ },
65
+ );