@storm-software/eslint 0.0.1

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/meta.json ADDED
@@ -0,0 +1 @@
1
+ {"inputs":{"packages/eslint/src/constants.ts":{"bytes":3659,"imports":[],"format":"esm"},"packages/eslint/src/base.ts":{"bytes":6065,"imports":[{"path":"packages/eslint/src/constants.ts","kind":"import-statement","original":"./constants"}],"format":"esm"},"packages/eslint/src/json.ts":{"bytes":980,"imports":[{"path":"packages/eslint/src/constants.ts","kind":"import-statement","original":"./constants"}],"format":"esm"},"packages/eslint/src/next.ts":{"bytes":876,"imports":[{"path":"packages/eslint/src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"next/babel","kind":"require-resolve","external":true}],"format":"esm"},"packages/eslint/src/recommended.ts":{"bytes":1908,"imports":[{"path":"eslint","kind":"import-statement","external":true},{"path":"packages/eslint/src/constants.ts","kind":"import-statement","original":"./constants"}],"format":"esm"},"packages/eslint/src/rules/react.ts":{"bytes":3805,"imports":[],"format":"esm"},"packages/eslint/src/rules/ts-docs.ts":{"bytes":295,"imports":[],"format":"esm"},"packages/eslint/src/react.ts":{"bytes":477,"imports":[{"path":"packages/eslint/src/rules/react.ts","kind":"import-statement","original":"./rules/react"},{"path":"packages/eslint/src/rules/ts-docs.ts","kind":"import-statement","original":"./rules/ts-docs"}],"format":"esm"},"packages/eslint/src/rules/import.ts":{"bytes":2873,"imports":[],"format":"esm"},"packages/eslint/src/rules/jsx-a11y.ts":{"bytes":192,"imports":[],"format":"esm"},"packages/eslint/src/rules/storm.ts":{"bytes":6500,"imports":[],"format":"esm"},"packages/eslint/src/rules/unicorn.ts":{"bytes":637,"imports":[],"format":"esm"},"packages/eslint/src/javascript.ts":{"bytes":461,"imports":[{"path":"packages/eslint/src/rules/import.ts","kind":"import-statement","original":"./rules/import"},{"path":"packages/eslint/src/rules/storm.ts","kind":"import-statement","original":"./rules/storm"},{"path":"packages/eslint/src/rules/unicorn.ts","kind":"import-statement","original":"./rules/unicorn"}],"format":"esm"},"packages/eslint/src/typescript.ts":{"bytes":5851,"imports":[{"path":"packages/eslint/src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"packages/eslint/src/rules/import.ts","kind":"import-statement","original":"./rules/import"},{"path":"packages/eslint/src/rules/storm.ts","kind":"import-statement","original":"./rules/storm"},{"path":"packages/eslint/src/rules/ts-docs.ts","kind":"import-statement","original":"./rules/ts-docs"},{"path":"packages/eslint/src/rules/unicorn.ts","kind":"import-statement","original":"./rules/unicorn"}],"format":"esm"},"packages/eslint/src/yml.ts":{"bytes":448,"imports":[{"path":"packages/eslint/src/constants.ts","kind":"import-statement","original":"./constants"}],"format":"esm"},"packages/eslint/src/nx.ts":{"bytes":1823,"imports":[],"format":"esm"},"packages/eslint/src/mdx.ts":{"bytes":1693,"imports":[{"path":"packages/eslint/src/constants.ts","kind":"import-statement","original":"./constants"}],"format":"esm"},"packages/eslint/src/graphql.ts":{"bytes":5648,"imports":[],"format":"esm"},"packages/eslint/src/jest.ts":{"bytes":255,"imports":[],"format":"esm"},"packages/eslint/src/index.ts":{"bytes":530,"imports":[{"path":"packages/eslint/src/base.ts","kind":"import-statement","original":"./base"},{"path":"packages/eslint/src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"packages/eslint/src/json.ts","kind":"import-statement","original":"./json"},{"path":"packages/eslint/src/next.ts","kind":"import-statement","original":"./next"},{"path":"packages/eslint/src/recommended.ts","kind":"import-statement","original":"./recommended"},{"path":"packages/eslint/src/react.ts","kind":"import-statement","original":"./react"},{"path":"packages/eslint/src/rules/import.ts","kind":"import-statement","original":"./rules/import"},{"path":"packages/eslint/src/rules/jsx-a11y.ts","kind":"import-statement","original":"./rules/jsx-a11y"},{"path":"packages/eslint/src/rules/react.ts","kind":"import-statement","original":"./rules/react"},{"path":"packages/eslint/src/rules/storm.ts","kind":"import-statement","original":"./rules/storm"},{"path":"packages/eslint/src/rules/ts-docs.ts","kind":"import-statement","original":"./rules/ts-docs"},{"path":"packages/eslint/src/rules/unicorn.ts","kind":"import-statement","original":"./rules/unicorn"},{"path":"packages/eslint/src/javascript.ts","kind":"import-statement","original":"./javascript"},{"path":"packages/eslint/src/typescript.ts","kind":"import-statement","original":"./typescript"},{"path":"packages/eslint/src/yml.ts","kind":"import-statement","original":"./yml"},{"path":"packages/eslint/src/nx.ts","kind":"import-statement","original":"./nx"},{"path":"packages/eslint/src/mdx.ts","kind":"import-statement","original":"./mdx"},{"path":"packages/eslint/src/graphql.ts","kind":"import-statement","original":"./graphql"},{"path":"packages/eslint/src/jest.ts","kind":"import-statement","original":"./jest"}],"format":"esm"}},"outputs":{"dist/packages/eslint/index.cjs":{"imports":[{"path":"next/babel","kind":"require-resolve","external":true}],"exports":[],"entryPoint":"packages/eslint/src/index.ts","inputs":{"packages/eslint/src/index.ts":{"bytesInOutput":409},"packages/eslint/src/constants.ts":{"bytesInOutput":3516},"packages/eslint/src/base.ts":{"bytesInOutput":5911},"packages/eslint/src/json.ts":{"bytesInOutput":856},"packages/eslint/src/next.ts":{"bytesInOutput":169},"packages/eslint/src/rules/react.ts":{"bytesInOutput":3750},"packages/eslint/src/rules/ts-docs.ts":{"bytesInOutput":242},"packages/eslint/src/react.ts":{"bytesInOutput":320},"packages/eslint/src/rules/import.ts":{"bytesInOutput":2867},"packages/eslint/src/rules/storm.ts":{"bytesInOutput":6445},"packages/eslint/src/rules/unicorn.ts":{"bytesInOutput":584},"packages/eslint/src/javascript.ts":{"bytesInOutput":265},"packages/eslint/src/typescript.ts":{"bytesInOutput":5546}},"bytes":32969},"dist/packages/eslint/base.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/base.ts","inputs":{"packages/eslint/src/base.ts":{"bytesInOutput":6065},"packages/eslint/src/constants.ts":{"bytesInOutput":3374}},"bytes":10325},"dist/packages/eslint/graphql.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/graphql.ts","inputs":{"packages/eslint/src/graphql.ts":{"bytesInOutput":5737}},"bytes":6557},"dist/packages/eslint/javascript.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/javascript.ts","inputs":{"packages/eslint/src/javascript.ts":{"bytesInOutput":450},"packages/eslint/src/rules/import.ts":{"bytesInOutput":2865},"packages/eslint/src/rules/storm.ts":{"bytesInOutput":6445},"packages/eslint/src/rules/unicorn.ts":{"bytesInOutput":584}},"bytes":11325},"dist/packages/eslint/json.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/json.ts","inputs":{"packages/eslint/src/json.ts":{"bytesInOutput":1009},"packages/eslint/src/constants.ts":{"bytesInOutput":2658}},"bytes":4553},"dist/packages/eslint/jest.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/jest.ts","inputs":{"packages/eslint/src/jest.ts":{"bytesInOutput":329}},"bytes":1146},"dist/packages/eslint/next.cjs":{"imports":[{"path":"next/babel","kind":"require-resolve","external":true}],"exports":[],"entryPoint":"packages/eslint/src/next.ts","inputs":{"packages/eslint/src/next.ts":{"bytesInOutput":957},"packages/eslint/src/constants.ts":{"bytesInOutput":2700}},"bytes":5140},"dist/packages/eslint/react.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/react.ts","inputs":{"packages/eslint/src/react.ts":{"bytesInOutput":482},"packages/eslint/src/rules/react.ts":{"bytesInOutput":3748},"packages/eslint/src/rules/ts-docs.ts":{"bytesInOutput":242}},"bytes":5403},"dist/packages/eslint/mdx.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/mdx.ts","inputs":{"packages/eslint/src/mdx.ts":{"bytesInOutput":1744},"packages/eslint/src/constants.ts":{"bytesInOutput":2658}},"bytes":5286},"dist/packages/eslint/yml.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/yml.ts","inputs":{"packages/eslint/src/yml.ts":{"bytesInOutput":475},"packages/eslint/src/constants.ts":{"bytesInOutput":2658}},"bytes":4017},"dist/packages/eslint/typescript.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/typescript.ts","inputs":{"packages/eslint/src/typescript.ts":{"bytesInOutput":5730},"packages/eslint/src/constants.ts":{"bytesInOutput":3374},"packages/eslint/src/rules/import.ts":{"bytesInOutput":2865},"packages/eslint/src/rules/storm.ts":{"bytesInOutput":6445},"packages/eslint/src/rules/ts-docs.ts":{"bytesInOutput":242},"packages/eslint/src/rules/unicorn.ts":{"bytesInOutput":584}},"bytes":20299},"dist/packages/eslint/recommended.cjs":{"imports":[],"exports":[],"entryPoint":"packages/eslint/src/recommended.ts","inputs":{"packages/eslint/src/recommended.ts":{"bytesInOutput":1964},"packages/eslint/src/constants.ts":{"bytesInOutput":2728}},"bytes":5592}}}
package/next.cjs ADDED
@@ -0,0 +1,137 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // packages/eslint/src/next.ts
30
+ var next_exports = {};
31
+ __export(next_exports, {
32
+ default: () => next_default
33
+ });
34
+ module.exports = __toCommonJS(next_exports);
35
+
36
+ // packages/eslint/src/constants.ts
37
+ var RESTRICTED_SYNTAX = [
38
+ {
39
+ // ❌ readFile(…, { encoding: … })
40
+ selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
41
+ message: "Specify encoding as last argument instead of object with encoding key"
42
+ },
43
+ {
44
+ // ❌ readFile(…, {})
45
+ selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
46
+ message: "Specify encoding as last argument"
47
+ },
48
+ {
49
+ // ❌ readFileSync(…).toString(…)
50
+ selector: "CallExpression[callee.name=readFileSync][parent.property.name=toString]",
51
+ message: "toString is redundant, specify encoding as last argument"
52
+ },
53
+ {
54
+ // ❌ ….readFile(…, { encoding: … })
55
+ selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
56
+ message: "Specify encoding as last argument instead of object with encoding key"
57
+ },
58
+ {
59
+ // ❌ ….readFile(…, {})
60
+ selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
61
+ message: "Specify encoding as last argument"
62
+ },
63
+ {
64
+ // ❌ Boolean(…)
65
+ selector: "CallExpression[callee.name=Boolean][arguments.1.elements.length!=0]",
66
+ message: "Prefer `!!\u2026` over `Boolean(\u2026)` because TypeScript infers a narrow literal boolean `type: true` instead of `type: boolean`."
67
+ },
68
+ {
69
+ // ❌ process.browser
70
+ selector: "ExpressionStatement[expression.object.name=process][expression.property.name=browser]",
71
+ message: "`process.browser` is deprecated, use `!!globalThis.window`"
72
+ }
73
+ // {
74
+ // // ❌ let { foo: { bar } } = baz
75
+ // // ✅ let { bar } = baz.foo
76
+ // // ✅ let { foo: { bar } } = await baz
77
+ // selector:
78
+ // 'VariableDeclarator[init.type!=AwaitExpression] > ObjectPattern[properties.length=1][properties.0.value.type=ObjectPattern]',
79
+ // message: 'Do not use nested destructuring.',
80
+ // },
81
+ ];
82
+ var REACT_RESTRICTED_SYNTAX = [
83
+ ...RESTRICTED_SYNTAX,
84
+ {
85
+ // ❌ useMemo(…, [])
86
+ selector: "CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]",
87
+ message: "`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead."
88
+ }
89
+ ];
90
+ var JS_FILES = ["*.js?(x)", "*.mjs"];
91
+ var CODE_FILE = "*.{,c,m}{j,t}s{,x}";
92
+
93
+ // packages/eslint/src/next.ts
94
+ var babelOptions = {
95
+ presets: (() => {
96
+ try {
97
+ require.resolve("next/babel");
98
+ return ["next/babel"];
99
+ } catch (_e) {
100
+ return [];
101
+ }
102
+ })()
103
+ };
104
+ var config = {
105
+ root: true,
106
+ ignorePatterns: ["next-env.d.ts"],
107
+ extends: ["plugin:@next/next/recommended"],
108
+ overrides: [
109
+ {
110
+ files: CODE_FILE,
111
+ extends: "./react-base"
112
+ },
113
+ {
114
+ files: [
115
+ "**/pages/**",
116
+ // Next.js pages directory use default export
117
+ "next.config.{js,mjs}",
118
+ "**/*.stories.tsx",
119
+ ".storybook/main.ts"
120
+ ],
121
+ rules: {
122
+ "import/no-default-export": "off"
123
+ }
124
+ },
125
+ {
126
+ files: ["next.config.{js,mjs}"],
127
+ env: {
128
+ node: true
129
+ }
130
+ },
131
+ {
132
+ files: JS_FILES,
133
+ parserOptions: { babelOptions }
134
+ }
135
+ ]
136
+ };
137
+ var next_default = config;
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@storm-software/eslint",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "description": "⚡ A package containing the base ESLint configuration used by Storm Software across many projects.",
6
+ "repository": {
7
+ "type": "github",
8
+ "url": "https://github.com/storm-software/storm-ops",
9
+ "directory": "packages/eslint"
10
+ },
11
+ "homepage": "https://stormsoftware.com",
12
+ "bugs": {
13
+ "url": "https://github.com/storm-software/storm-ops/issues",
14
+ "email": "support@stormsoftware.com"
15
+ },
16
+ "author": {
17
+ "name": "Storm Software",
18
+ "email": "contact@stormsoftware.com",
19
+ "url": "https://stormsoftware.com"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "private": false,
23
+ "exports": {
24
+ ".": "./src/index.js",
25
+ "./index": "./src/index.js",
26
+ "./*": "./src/*.js",
27
+ "./rules": "./src/rules/index.js",
28
+ "./rules/*": "./src/rules/*.js",
29
+ "./package.json": "./package.json"
30
+ },
31
+ "keywords": [
32
+ "storm",
33
+ "storm-ops",
34
+ "sullivanpj",
35
+ "eslint",
36
+ "monorepo"
37
+ ],
38
+ "dependencies": {
39
+ "@graphql-eslint/eslint-plugin": "^3.20.1",
40
+ "@typescript-eslint/eslint-plugin": "^7.11.0",
41
+ "@typescript-eslint/parser": "^7.0.0",
42
+ "eslint": "9.4.0",
43
+ "eslint-config-prettier": "^9.1.0",
44
+ "eslint-import-resolver-typescript": "^3.6.1",
45
+ "eslint-plugin-import": "^2.29.1",
46
+ "eslint-plugin-jsonc": "^2.11.1",
47
+ "eslint-plugin-jsx-a11y": "^6.8.0",
48
+ "eslint-plugin-mdx": "^3.0.0",
49
+ "eslint-plugin-n": "^17.0.0",
50
+ "eslint-plugin-promise": "^6.1.1",
51
+ "eslint-plugin-react": "^7.33.2",
52
+ "eslint-plugin-react-hooks": "^4.6.0",
53
+ "eslint-plugin-sonarjs": "^1.0.0",
54
+ "eslint-plugin-unicorn": "^52.0.0",
55
+ "eslint-plugin-yml": "^1.11.0",
56
+ "relay": "0.8.0-1"
57
+ },
58
+ "devDependencies": {
59
+ "@types/eslint": "8.56.10"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public"
63
+ }
64
+ }
package/react.cjs ADDED
@@ -0,0 +1,159 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/eslint/src/react.ts
20
+ var react_exports = {};
21
+ __export(react_exports, {
22
+ default: () => react_default2
23
+ });
24
+ module.exports = __toCommonJS(react_exports);
25
+
26
+ // packages/eslint/src/rules/react.ts
27
+ var config = {
28
+ // We recommend using TypeScript over `prop-types`, as `prop-types` can add
29
+ // to a project's build size.
30
+ "react/prop-types": "off",
31
+ // Disable requiring React to be imported, as this is no longer required.
32
+ "react/react-in-jsx-scope": "off",
33
+ /**
34
+ * Require an explicit type when using button elements.
35
+ *
36
+ * 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
37
+ */
38
+ "react/button-has-type": "warn",
39
+ /**
40
+ * Require consistent function type for function components.
41
+ *
42
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/HEAD/docs/rules/function-component-definition.md
43
+ */
44
+ "react/function-component-definition": "warn",
45
+ /**
46
+ * Require destructuring and symmetric naming of `useState` hook value and setter variables.
47
+ *
48
+ * 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
49
+ */
50
+ "react/hook-use-state": "warn",
51
+ /**
52
+ * Require consistent boolean attributes notation in JSX.
53
+ *
54
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
55
+ */
56
+ "react/jsx-boolean-value": "warn",
57
+ /**
58
+ * Disallow unnecessary curly braces in JSX props and children.
59
+ *
60
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
61
+ */
62
+ "react/jsx-curly-brace-presence": "warn",
63
+ /**
64
+ * Require using shorthand form for React fragments, unless required.
65
+ *
66
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
67
+ */
68
+ "react/jsx-fragments": "warn",
69
+ /**
70
+ * Prevent problematic leaked values from being rendered.
71
+ *
72
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
73
+ */
74
+ "react/jsx-no-leaked-render": "warn",
75
+ /**
76
+ * Prevents usage of unsafe `target='_blank'`.
77
+ *
78
+ * This rule is a part of `react/recommended`, but we've modified it to
79
+ * allow referrer.
80
+ *
81
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
82
+ */
83
+ "react/jsx-no-target-blank": [
84
+ "error",
85
+ {
86
+ allowReferrer: true
87
+ }
88
+ ],
89
+ /**
90
+ * Disallow empty React fragments.
91
+ *
92
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
93
+ */
94
+ "react/jsx-no-useless-fragment": ["warn", { allowExpressions: true }],
95
+ /**
96
+ * Require the use of PascalCase for user-defined JSX components.
97
+ *
98
+ * 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
99
+ */
100
+ "react/jsx-pascal-case": "warn",
101
+ /**
102
+ * Require props to be sorted alphabetically.
103
+ *
104
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
105
+ */
106
+ "react/jsx-sort-props": "warn",
107
+ /**
108
+ * Disallow usage of Array index in keys.
109
+ *
110
+ * 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
111
+ */
112
+ "react/no-array-index-key": "warn",
113
+ /**
114
+ * Disallow creating unstable components inside components.
115
+ *
116
+ * 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
117
+ */
118
+ "react/no-unstable-nested-components": "error",
119
+ /**
120
+ * Disallow closing tags for components without children.
121
+ *
122
+ * 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
123
+ */
124
+ "react/self-closing-comp": "warn"
125
+ };
126
+ var react_default = config;
127
+
128
+ // packages/eslint/src/rules/ts-docs.ts
129
+ var config2 = {
130
+ /**
131
+ * Require TSDoc comments conform to the TSDoc specification.
132
+ *
133
+ * 🚫 Not fixable - https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
134
+ */
135
+ "tsdoc/syntax": "error"
136
+ };
137
+ var ts_docs_default = config2;
138
+
139
+ // packages/eslint/src/react.ts
140
+ var config3 = {
141
+ root: true,
142
+ extends: [
143
+ "plugin:react/recommended",
144
+ "plugin:react-hooks/recommended",
145
+ "plugin:jsx-a11y/recommended",
146
+ "plugin:import/react",
147
+ "prettier"
148
+ ],
149
+ settings: {
150
+ react: {
151
+ version: "detect"
152
+ }
153
+ },
154
+ rules: {
155
+ ...ts_docs_default,
156
+ ...react_default
157
+ }
158
+ };
159
+ var react_default2 = config3;
@@ -0,0 +1,167 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/eslint/src/recommended.ts
20
+ var recommended_exports = {};
21
+ __export(recommended_exports, {
22
+ default: () => recommended_default
23
+ });
24
+ module.exports = __toCommonJS(recommended_exports);
25
+
26
+ // packages/eslint/src/constants.ts
27
+ var RESTRICTED_SYNTAX = [
28
+ {
29
+ // ❌ readFile(…, { encoding: … })
30
+ selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
31
+ message: "Specify encoding as last argument instead of object with encoding key"
32
+ },
33
+ {
34
+ // ❌ readFile(…, {})
35
+ selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
36
+ message: "Specify encoding as last argument"
37
+ },
38
+ {
39
+ // ❌ readFileSync(…).toString(…)
40
+ selector: "CallExpression[callee.name=readFileSync][parent.property.name=toString]",
41
+ message: "toString is redundant, specify encoding as last argument"
42
+ },
43
+ {
44
+ // ❌ ….readFile(…, { encoding: … })
45
+ selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
46
+ message: "Specify encoding as last argument instead of object with encoding key"
47
+ },
48
+ {
49
+ // ❌ ….readFile(…, {})
50
+ selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
51
+ message: "Specify encoding as last argument"
52
+ },
53
+ {
54
+ // ❌ Boolean(…)
55
+ selector: "CallExpression[callee.name=Boolean][arguments.1.elements.length!=0]",
56
+ message: "Prefer `!!\u2026` over `Boolean(\u2026)` because TypeScript infers a narrow literal boolean `type: true` instead of `type: boolean`."
57
+ },
58
+ {
59
+ // ❌ process.browser
60
+ selector: "ExpressionStatement[expression.object.name=process][expression.property.name=browser]",
61
+ message: "`process.browser` is deprecated, use `!!globalThis.window`"
62
+ }
63
+ // {
64
+ // // ❌ let { foo: { bar } } = baz
65
+ // // ✅ let { bar } = baz.foo
66
+ // // ✅ let { foo: { bar } } = await baz
67
+ // selector:
68
+ // 'VariableDeclarator[init.type!=AwaitExpression] > ObjectPattern[properties.length=1][properties.0.value.type=ObjectPattern]',
69
+ // message: 'Do not use nested destructuring.',
70
+ // },
71
+ ];
72
+ var REACT_RESTRICTED_SYNTAX = [
73
+ ...RESTRICTED_SYNTAX,
74
+ {
75
+ // ❌ useMemo(…, [])
76
+ selector: "CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]",
77
+ message: "`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead."
78
+ }
79
+ ];
80
+ var CODE_BLOCK = "**/*.md{,x}/*";
81
+ var CODE_FILE = "*.{,c,m}{j,t}s{,x}";
82
+ var TS_FILE = "*.{,c,m}ts{,x}";
83
+
84
+ // packages/eslint/src/recommended.ts
85
+ var config = {
86
+ extends: [
87
+ "./base",
88
+ "./nx",
89
+ "./json",
90
+ "./yml",
91
+ "./javascript",
92
+ "./typescript",
93
+ "./react",
94
+ "./next"
95
+ ],
96
+ reportUnusedDisableDirectives: true,
97
+ ignorePatterns: [
98
+ "!.*",
99
+ // Don't ignore dot-files because by default ESLint ignore dot-files (except for .eslintrc.*) and dot-folders
100
+ ".git"
101
+ ],
102
+ overrides: [
103
+ {
104
+ files: CODE_FILE,
105
+ extends: "./base"
106
+ },
107
+ {
108
+ // Rules which require type info and exclude virtual ts files extracted by `eslint-plugin-mdx`
109
+ files: TS_FILE,
110
+ excludedFiles: [CODE_BLOCK],
111
+ rules: {
112
+ "@typescript-eslint/prefer-optional-chain": "error"
113
+ }
114
+ },
115
+ {
116
+ files: TS_FILE,
117
+ rules: {
118
+ "@typescript-eslint/consistent-type-assertions": "error"
119
+ }
120
+ },
121
+ {
122
+ files: ["*.c{j,t}s"],
123
+ env: { node: true },
124
+ rules: { "@typescript-eslint/no-var-requires": "off" }
125
+ },
126
+ {
127
+ files: [
128
+ "jest.config.js",
129
+ "webpack.config.js",
130
+ "bob.config.js",
131
+ "babel.config.js",
132
+ "postcss.config.{js,cjs}",
133
+ "rollup.config.js",
134
+ "next-sitemap.config.js"
135
+ ],
136
+ env: { node: true }
137
+ },
138
+ {
139
+ files: ["*.{spec,test}.*"],
140
+ env: { jest: true },
141
+ rules: { "import/extensions": ["error", "never"] }
142
+ },
143
+ {
144
+ files: [
145
+ "vite.config.ts",
146
+ "jest.config.js",
147
+ "*.d.ts",
148
+ "website/theme.config.tsx",
149
+ "tsup.config.ts",
150
+ "postcss.config.ts",
151
+ "tailwind.config.ts",
152
+ "next-sitemap.config.js"
153
+ ],
154
+ rules: { "import/no-default-export": "off" }
155
+ },
156
+ {
157
+ files: ["*.d.ts"],
158
+ rules: {
159
+ "no-var": "off"
160
+ }
161
+ }
162
+ ],
163
+ "globals": {
164
+ "BigInt": true
165
+ }
166
+ };
167
+ var recommended_default = config;