@lunit/eslint-config 1.0.0 → 2.0.0

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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @lunit/eslint-config
2
2
 
3
- A TypeScript ESLint ruleset designed for lunit projects based on [@rushstack/eslint-config](https://github.com/microsoft/rushstack/tree/main/eslint/eslint-config).
3
+ A TypeScript ESLint ruleset designed for Lunit projects based on [@rushstack/eslint-config](https://github.com/microsoft/rushstack/tree/main/eslint/eslint-config).
4
+
5
+ This ESLint configuration is only available for TypeScript projects.
4
6
 
5
7
  ## Installation
6
8
 
@@ -10,72 +12,246 @@ npm install --save-dev @lunit/eslint-config
10
12
 
11
13
  ## Usage
12
14
 
13
- Referring to the [sapmple-project](./sample-project/) folder, create [eslint-config](./sample-project/eslint-config/) folder in the project repository root folder, add [index.js](./sample-project/eslint-config/index.js) file, and then extend the **eslint-config** folder to the [.eslintrc.cjs](./sample-project/.eslintrc.cjs) file.
15
+ ### Getting Started
14
16
 
15
- ```shell
16
- # Project folder structure
17
- sample-project/
18
- ├── .eslintrc.cjs
19
- └── eslint-config
20
- ├── index.js
21
- └── mixins
22
- └── react.js
23
- ```
17
+ `@lunit/eslint-config v2.x` is configured using the ESLint Flat Config approach.
18
+
19
+ For information regarding ESLint Flat Config, please refer to the relevant ESLint Blog post.
20
+ - https://eslint.org/blog/2022/08/new-config-system-part-2/
21
+
22
+
23
+ To use it, add @lunit/eslint-config to your eslint.config.js file as follows.
24
+ If you are using TypeScript ESLint rules, please remove them.
25
+ This is already being used in Rushstack ESLint, causing conflict issues.
26
+
27
+
28
+ #### ESM
24
29
 
25
30
  ```javascript
26
- // .eslintrc.cjs
27
- module.exports = {
28
- ...
29
- extends: [
30
- './eslint-config', // Extend common ESLint config
31
- ],
32
- settings: {
33
- react: {
34
- // Specifies the current React version (e.g. version: '18.2')
35
- // If not specified (default 'detect'), the entire React library will be loaded,
36
- // which may slow down the linting process.
37
- version: 'detect',
31
+ // eslint.config.js
32
+ import js from "@eslint/js";
33
+ import globals from "globals";
34
+ import reactHooks from "eslint-plugin-react-hooks";
35
+ import reactRefresh from "eslint-plugin-react-refresh";
36
+ import { defineConfig, globalIgnores } from "eslint/config";
37
+ import eslintConfig from '@lunit/eslint-config';
38
+
39
+ export default defineConfig([
40
+ globalIgnores(["dist"]),
41
+ {
42
+ files: ["**/*.{ts,tsx}"],
43
+ extends: [
44
+ js.configs.recommended,
45
+ reactHooks.configs.flat["recommended-latest"],
46
+ reactRefresh.configs.vite,
47
+ ],
48
+ languageOptions: {
49
+ ecmaVersion: 2020,
50
+ globals: globals.browser,
38
51
  },
39
52
  },
40
- ...
41
- };
53
+ lunitEslintConfig,
54
+ ]);
42
55
  ```
43
56
 
44
- If necessary, add your own mixin to the [eslint-config/mixins](./sample-project/eslint-config/mixins/) folder and use it, or use the mixins in [@rushstack/eslint-config/mixins](https://github.com/microsoft/rushstack/tree/main/eslint/eslint-config/mixins). (Refer to [eslint-config/index.js](./sample-project/eslint-config/index.js))
57
+ #### CommonJS
45
58
 
46
59
  ```javascript
47
- // eslint-config/index.js
48
- module.exports = {
49
- ...
50
- extends: [
51
- // (required) Extend the @lunit/eslint-config.
52
- // (@rushstack/eslint-config/profile/web-app is included by default.)
53
- '@lunit/eslint-config',
54
- // React mixin provided by rushstack (requires installation of @rushstack/eslint-config package)
55
- // '@rushstack/eslint-config/mixins/react',
56
- // You can create and use your own mixin as follows.
57
- './mixins/react',
58
- ],
59
- ...
60
- };
60
+ // eslint.config.cjs
61
+ const js = require("@eslint/js");
62
+ const globals = require("globals");
63
+ const reactHooks = require("eslint-plugin-react-hooks");
64
+ const reactRefresh = require("eslint-plugin-react-refresh");
65
+ const { defineConfig, globalIgnores } = require("eslint/config");
66
+ const lunitEslintConfig = require('@lunit/eslint-config');
67
+
68
+ module.exports = defineConfig([
69
+ globalIgnores(["dist"]),
70
+ {
71
+ files: ["**/*.{ts,tsx}"],
72
+ extends: [
73
+ js.configs.recommended,
74
+ reactHooks.configs.flat["recommended-latest"],
75
+ reactRefresh.configs.vite,
76
+ ],
77
+ languageOptions: {
78
+ ecmaVersion: 2020,
79
+ globals: globals.browser,
80
+ },
81
+ },
82
+ // You can add the ESLint Config rules as follows.
83
+ lunitEslintConfig,
84
+ ]);
61
85
  ```
62
86
 
63
- <!--
64
- To use [@rushstack/eslint-config/mixins/react](https://github.com/microsoft/rushstack/blob/main/eslint/eslint-config/mixins/react.js) mixin, you need to install the package as follow.
87
+ > If you created the app using vite,
88
+ > please refer to the information below.
65
89
 
66
- ```shell
67
- npm install --save-dev @rushstack/eslint-config
90
+ If the tsconfig.json file is separate and the actual rules are applied in `tsconfig.app.json`,
91
+ please configure it as follows.
92
+
93
+ rushstack eslint config internally follows the rules set in tsconfig,
94
+ so you must link the corresponding JSON file.
95
+
96
+ #### ESM
97
+ ```js
98
+ // eslint.config.js
99
+ import js from "@eslint/js";
100
+ import globals from "globals";
101
+ import reactHooks from "eslint-plugin-react-hooks";
102
+ import reactRefresh from "eslint-plugin-react-refresh";
103
+ import { defineConfig, globalIgnores } from "eslint/config";
104
+ import eslintConfig from '@lunit/eslint-config';
105
+
106
+ export default defineConfig([
107
+ globalIgnores(["dist"]),
108
+ {
109
+ files: ["**/*.{ts,tsx}"],
110
+ extends: [
111
+ js.configs.recommended,
112
+ reactHooks.configs.flat["recommended-latest"],
113
+ reactRefresh.configs.vite,
114
+ ],
115
+ languageOptions: {
116
+ ecmaVersion: 2020,
117
+ globals: globals.browser,
118
+ },
119
+ },
120
+ {
121
+ ...eslintConfig,
122
+ // You must integrate the tsconfig.app.json file applied to the actual ts and tsx files as shown below.
123
+ languageOptions: {
124
+ parserOptions: {
125
+ project: ["./tsconfig.app.json"],
126
+ tsconfigRootDir: import.meta.dirname,
127
+ },
128
+ },
129
+ }
130
+ ]);
68
131
  ```
69
- -->
70
132
 
71
- Refer to the default settings in [@lunit/eslint-config/index.js](./index.js) & [@rushstack/eslint-config/profile/web-app](https://github.com/microsoft/rushstack/blob/main/eslint/eslint-config/profile/_common.js) and add your own rules to the config if necessary.
72
- Any esconfig rule entries added must have a valid **RATIONALE**.
133
+ #### CommonJS
73
134
 
74
- ```javascript
75
- rules: {
76
- ...
77
- // RATIONALE : Enforce consistent function types for function components.
78
- 'react/function-component-definition': 'error',
79
- ...
80
- },
135
+ ```js
136
+ // eslint.config.cjs
137
+ const js = require("@eslint/js");
138
+ const globals = require("globals");
139
+ const reactHooks = require("eslint-plugin-react-hooks");
140
+ const reactRefresh = require("eslint-plugin-react-refresh");
141
+ const { defineConfig, globalIgnores } = require("eslint/config");
142
+ const lunitEslintConfig = require('@lunit/eslint-config');
143
+
144
+ module.exports = defineConfig([
145
+ globalIgnores(["dist"]),
146
+ {
147
+ files: ["**/*.{ts,tsx}"],
148
+ extends: [
149
+ js.configs.recommended,
150
+ reactHooks.configs.flat["recommended-latest"],
151
+ reactRefresh.configs.vite,
152
+ ],
153
+ languageOptions: {
154
+ ecmaVersion: 2020,
155
+ globals: globals.browser,
156
+ },
157
+ },
158
+ {
159
+ ...lunitEslintConfig,
160
+ // You must integrate the tsconfig.app.json file applied to the actual ts and tsx files as shown below.
161
+ languageOptions: {
162
+ parserOptions: {
163
+ project: ["./tsconfig.app.json"],
164
+ tsconfigRootDir: __dirname,
165
+ },
166
+ },
167
+ }
168
+ ]);
169
+ ```
170
+
171
+ ### Advanced
172
+
173
+ #### Override rushstack eslint rule
174
+
175
+ If you wish to modify the Rushstack ESLint rule, please refer to the code below.
176
+
177
+ #### ESM
178
+ ```js
179
+ // eslint.config.js
180
+ import js from "@eslint/js";
181
+ import globals from "globals";
182
+ import reactHooks from "eslint-plugin-react-hooks";
183
+ import reactRefresh from "eslint-plugin-react-refresh";
184
+ import { defineConfig, globalIgnores } from "eslint/config";
185
+ import eslintConfig from '@lunit/eslint-config';
186
+
187
+ export default defineConfig([
188
+ globalIgnores(["dist"]),
189
+ {
190
+ files: ["**/*.{ts,tsx}"],
191
+ extends: [
192
+ js.configs.recommended,
193
+ reactHooks.configs.flat["recommended-latest"],
194
+ reactRefresh.configs.vite,
195
+ ],
196
+ languageOptions: {
197
+ ecmaVersion: 2020,
198
+ globals: globals.browser,
199
+ },
200
+ },
201
+ {
202
+ // Using Spread Operator lunit Eslint Config
203
+ ...lunitEslintConfig,
204
+ rules: {
205
+ // Using Spread Operator lunit Eslint Config Rules
206
+ ...lunitEslintConfig.rules,
207
+ // And apply the target rule
208
+ '@rushstack/no-new-null': 'error',
209
+ },
210
+ }
211
+ ]);
81
212
  ```
213
+
214
+ #### CommonJS
215
+
216
+ ```js
217
+ // eslint.config.cjs
218
+ const js = require("@eslint/js");
219
+ const globals = require("globals");
220
+ const reactHooks = require("eslint-plugin-react-hooks");
221
+ const reactRefresh = require("eslint-plugin-react-refresh");
222
+ const { defineConfig, globalIgnores } = require("eslint/config");
223
+ const lunitEslintConfig = require('@lunit/eslint-config');
224
+
225
+ module.exports = defineConfig([
226
+ globalIgnores(["dist"]),
227
+ {
228
+ files: ["**/*.{ts,tsx}"],
229
+ extends: [
230
+ js.configs.recommended,
231
+ reactHooks.configs.flat["recommended-latest"],
232
+ reactRefresh.configs.vite,
233
+ ],
234
+ languageOptions: {
235
+ ecmaVersion: 2020,
236
+ globals: globals.browser,
237
+ },
238
+ },
239
+ {
240
+ // Using Spread Operator lunit Eslint Config
241
+ ...lunitEslintConfig,
242
+ rules: {
243
+ // Using Spread Operator lunit Eslint Config Rules
244
+ ...lunitEslintConfig.rules,
245
+ // And apply the target rule
246
+ '@rushstack/no-new-null': 'error',
247
+ },
248
+ }
249
+ ]);
250
+ ```
251
+
252
+ #### Migrate 1.x to 2.x
253
+
254
+ Since migration to the ESLint flat config is required,
255
+ please refer to the official ESLint documentation guide below.
256
+
257
+ - https://eslint.org/docs/latest/use/configure/migration-guide
package/dist/index.js ADDED
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ const react = require("@rushstack/eslint-config/flat/mixins/react.js");
3
+ const webApp = require("@rushstack/eslint-config/flat/profile/web-app.js");
4
+ function _interopNamespaceDefault(e) {
5
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
+ if (e) {
7
+ for (const k in e) {
8
+ if (k !== "default") {
9
+ const d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: () => e[k]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ n.default = e;
18
+ return Object.freeze(n);
19
+ }
20
+ const react__namespace = /* @__PURE__ */ _interopNamespaceDefault(react);
21
+ const webApp__namespace = /* @__PURE__ */ _interopNamespaceDefault(webApp);
22
+ function getDefaultExportFromCjs(x) {
23
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
24
+ }
25
+ function getAugmentedNamespace(n) {
26
+ if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
27
+ var f = n.default;
28
+ if (typeof f == "function") {
29
+ var a = function a2() {
30
+ var isInstance = false;
31
+ try {
32
+ isInstance = this instanceof a2;
33
+ } catch {
34
+ }
35
+ if (isInstance) {
36
+ return Reflect.construct(f, arguments, this.constructor);
37
+ }
38
+ return f.apply(this, arguments);
39
+ };
40
+ a.prototype = f.prototype;
41
+ } else a = {};
42
+ Object.defineProperty(a, "__esModule", { value: true });
43
+ Object.keys(n).forEach(function(k) {
44
+ var d = Object.getOwnPropertyDescriptor(n, k);
45
+ Object.defineProperty(a, k, d.get ? d : {
46
+ enumerable: true,
47
+ get: function() {
48
+ return n[k];
49
+ }
50
+ });
51
+ });
52
+ return a;
53
+ }
54
+ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(react__namespace);
55
+ const require$$1 = /* @__PURE__ */ getAugmentedNamespace(webApp__namespace);
56
+ var eslintConfig;
57
+ var hasRequiredEslintConfig;
58
+ function requireEslintConfig() {
59
+ if (hasRequiredEslintConfig) return eslintConfig;
60
+ hasRequiredEslintConfig = 1;
61
+ const rushStackReactConfig = require$$0;
62
+ const rushStackWebAppConfig = require$$1;
63
+ function cleanConfig(config) {
64
+ if (Array.isArray(config)) {
65
+ return config.map(cleanConfig);
66
+ }
67
+ if (config && typeof config === "object" && config.default) {
68
+ return cleanConfig(config.default);
69
+ }
70
+ return config;
71
+ }
72
+ const cleanedExtends = [rushStackWebAppConfig, rushStackReactConfig].map(cleanConfig);
73
+ eslintConfig = {
74
+ files: ["**/*.ts", "**/*.tsx"],
75
+ extends: cleanedExtends,
76
+ rules: {
77
+ /**
78
+ * RATIONALE : The null type is universally used, so it is excluded.
79
+ * docs: https://www.npmjs.com/package/@rushstack/eslint-plugin
80
+ */
81
+ "@rushstack/no-new-null": "off",
82
+ /**
83
+ * RATIONALE : Rushstack's policy enforces explicit types for top-level variables for readability,
84
+ * but our project prefers to leverage TypeScript's type inference.
85
+ * docs: https://github.com/microsoft/rushstack/tree/main/eslint/eslint-plugin#rushstacktypedef-var
86
+ */
87
+ "@rushstack/typedef-var": "off",
88
+ /**
89
+ * RATIONALE : According to the documentation, it can be used in projects that use many classes,
90
+ * but it is unnecessary because the development pattern is functional.
91
+ * docs: https://typescript-eslint.io/rules/explicit-member-accessibility/
92
+ */
93
+ "@typescript-eslint/explicit-member-accessibility": "off",
94
+ /**
95
+ * RATIONALE : Depending on the situation, it may be better to leave the return type to type inference.
96
+ * docs: https://typescript-eslint.io/rules/explicit-function-return-type/
97
+ */
98
+ "@typescript-eslint/explicit-function-return-type": "off"
99
+ },
100
+ settings: {
101
+ react: {
102
+ version: "detect"
103
+ }
104
+ }
105
+ };
106
+ return eslintConfig;
107
+ }
108
+ var eslintConfigExports = requireEslintConfig();
109
+ const index = /* @__PURE__ */ getDefaultExportFromCjs(eslintConfigExports);
110
+ module.exports = index;
package/dist/index.mjs ADDED
@@ -0,0 +1,91 @@
1
+ import * as react from "@rushstack/eslint-config/flat/mixins/react.js";
2
+ import * as webApp from "@rushstack/eslint-config/flat/profile/web-app.js";
3
+ function getDefaultExportFromCjs(x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
+ }
6
+ function getAugmentedNamespace(n) {
7
+ if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
8
+ var f = n.default;
9
+ if (typeof f == "function") {
10
+ var a = function a2() {
11
+ var isInstance = false;
12
+ try {
13
+ isInstance = this instanceof a2;
14
+ } catch {
15
+ }
16
+ if (isInstance) {
17
+ return Reflect.construct(f, arguments, this.constructor);
18
+ }
19
+ return f.apply(this, arguments);
20
+ };
21
+ a.prototype = f.prototype;
22
+ } else a = {};
23
+ Object.defineProperty(a, "__esModule", { value: true });
24
+ Object.keys(n).forEach(function(k) {
25
+ var d = Object.getOwnPropertyDescriptor(n, k);
26
+ Object.defineProperty(a, k, d.get ? d : {
27
+ enumerable: true,
28
+ get: function() {
29
+ return n[k];
30
+ }
31
+ });
32
+ });
33
+ return a;
34
+ }
35
+ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(react);
36
+ const require$$1 = /* @__PURE__ */ getAugmentedNamespace(webApp);
37
+ var eslintConfig;
38
+ var hasRequiredEslintConfig;
39
+ function requireEslintConfig() {
40
+ if (hasRequiredEslintConfig) return eslintConfig;
41
+ hasRequiredEslintConfig = 1;
42
+ const rushStackReactConfig = require$$0;
43
+ const rushStackWebAppConfig = require$$1;
44
+ function cleanConfig(config) {
45
+ if (Array.isArray(config)) {
46
+ return config.map(cleanConfig);
47
+ }
48
+ if (config && typeof config === "object" && config.default) {
49
+ return cleanConfig(config.default);
50
+ }
51
+ return config;
52
+ }
53
+ const cleanedExtends = [rushStackWebAppConfig, rushStackReactConfig].map(cleanConfig);
54
+ eslintConfig = {
55
+ files: ["**/*.ts", "**/*.tsx"],
56
+ extends: cleanedExtends,
57
+ rules: {
58
+ /**
59
+ * RATIONALE : The null type is universally used, so it is excluded.
60
+ * docs: https://www.npmjs.com/package/@rushstack/eslint-plugin
61
+ */
62
+ "@rushstack/no-new-null": "off",
63
+ /**
64
+ * RATIONALE : Rushstack's policy enforces explicit types for top-level variables for readability,
65
+ * but our project prefers to leverage TypeScript's type inference.
66
+ * docs: https://github.com/microsoft/rushstack/tree/main/eslint/eslint-plugin#rushstacktypedef-var
67
+ */
68
+ "@rushstack/typedef-var": "off",
69
+ /**
70
+ * RATIONALE : According to the documentation, it can be used in projects that use many classes,
71
+ * but it is unnecessary because the development pattern is functional.
72
+ * docs: https://typescript-eslint.io/rules/explicit-member-accessibility/
73
+ */
74
+ "@typescript-eslint/explicit-member-accessibility": "off",
75
+ /**
76
+ * RATIONALE : Depending on the situation, it may be better to leave the return type to type inference.
77
+ * docs: https://typescript-eslint.io/rules/explicit-function-return-type/
78
+ */
79
+ "@typescript-eslint/explicit-function-return-type": "off"
80
+ },
81
+ settings: {
82
+ react: {
83
+ version: "detect"
84
+ }
85
+ }
86
+ };
87
+ return eslintConfig;
88
+ }
89
+ var eslintConfigExports = requireEslintConfig();
90
+ const index = /* @__PURE__ */ getDefaultExportFromCjs(eslintConfigExports);
91
+ export default index;
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "@lunit/eslint-config",
3
- "version": "1.0.0",
4
- "description": "Lunit ESLnt Config",
5
- "main": "index.js",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/lunit-io/eslint-config.git"
3
+ "version": "2.0.0",
4
+ "description": "Lunit ESLint Config",
5
+ "type": "commonjs",
6
+ "main": "dist/index.js",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ }
9
15
  },
16
+ "repository": "lunit-io/eslint-config",
10
17
  "author": {
11
18
  "name": "Larry Kim",
12
19
  "email": "larry@lunit.io"
@@ -14,6 +21,9 @@
14
21
  "publishConfig": {
15
22
  "access": "public"
16
23
  },
24
+ "scripts": {
25
+ "build": "vite build"
26
+ },
17
27
  "license": "MIT",
18
28
  "peerDependencies": {
19
29
  "eslint": ">= 8",
@@ -21,7 +31,12 @@
21
31
  "typescript": ">= 5"
22
32
  },
23
33
  "dependencies": {
24
- "@rushstack/eslint-config": "^4.0.2",
25
- "@rushstack/eslint-patch": "^1.10.4"
34
+ "@rushstack/eslint-config": "^4.4.0"
35
+ },
36
+ "devDependencies": {
37
+ "@rollup/plugin-commonjs": "^28.0.6",
38
+ "eslint": "^9.36.0",
39
+ "typescript": "^5.8.3",
40
+ "vite": "^7.1.7"
26
41
  }
27
42
  }
package/index.js DELETED
@@ -1,43 +0,0 @@
1
- /*
2
- * @rushstack/eslint-patch is used to include plugins as dev
3
- * dependencies instead of imposing them as peer dependencies
4
- *
5
- * https://www.npmjs.com/package/@rushstack/eslint-patch
6
- */
7
- require('@rushstack/eslint-patch/modern-module-resolution');
8
-
9
- module.exports = {
10
- extends: ['@rushstack/eslint-config/profile/web-app'],
11
- plugins: [],
12
- rules: {},
13
- settings: {
14
- react: {
15
- version: 'detect',
16
- },
17
- },
18
- overrides: [
19
- {
20
- files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
21
- rules: {
22
- // RATIONALE : Too many parts are initialized to null, so turn it off for now.
23
- '@rushstack/no-new-null': 'off',
24
- },
25
- },
26
- {
27
- files: ['*.ts', '*.tsx'],
28
- rules: {
29
- // RATIONALE : Enforcing type definitions where type inference is sufficient
30
- '@rushstack/typedef-var': 'off',
31
- // RATIONALE : According to the documentation, it can be used in projects that use many classes,
32
- // but it is unnecessary because the development pattern is functional.
33
- '@typescript-eslint/explicit-member-accessibility': 'off',
34
- // RATIONALE : Depending on the situation, it may be better to leave the return type to type inference.
35
- '@typescript-eslint/explicit-function-return-type': 'off',
36
- },
37
- },
38
- {
39
- files: ['*.js', '*.jsx'],
40
- rules: {},
41
- },
42
- ],
43
- };
@@ -1 +0,0 @@
1
- node_modules
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: { browser: true, es2020: true },
4
- ignorePatterns: ['**/*'],
5
- extends: [
6
- './eslint-config', // Extend common ESLint config
7
- ],
8
- settings: {
9
- react: {
10
- // Specifies the current React version (e.g. version: '18.2')
11
- // If not specified (default 'detect'), the entire React library will be loaded,
12
- // which may slow down the linting process.
13
- version: '18.2',
14
- },
15
- },
16
- };
@@ -1,4 +0,0 @@
1
- # Add files here to ignore them from prettier formatting
2
-
3
- /dist
4
- /coverage
@@ -1,12 +0,0 @@
1
- const config = {
2
- printWidth: 100,
3
- trailingComma: 'all', // Default
4
- tabWidth: 2, // Default
5
- semi: true, // Adding a semicolon to the beginning of a line in some code
6
- singleQuote: true,
7
- bracketSpacing: true, // Default. If true, {foo:bar} is converted to { foo: bar }
8
- arrowParens: 'always', // Default
9
- useTabs: false, // Default
10
- };
11
-
12
- export default config;
@@ -1,34 +0,0 @@
1
- module.exports = {
2
- // Define the required plugins here.
3
- plugins: ['prettier'],
4
- extends: [
5
- // (required) Extend the @lunit/eslint-config.
6
- // (@rushstack/eslint-config/profile/web-app is included by default.)
7
- '@lunit/eslint-config',
8
- // React mixin provided by rushstack (requires installation of @rushstack/eslint-config package)
9
- '@rushstack/eslint-config/mixins/react',
10
- // You can create and use your own mixin as follows.
11
- // './mixins/react',
12
- ],
13
- rules: {},
14
- settings: {
15
- // If there are any common settings you would like to add, please add them.
16
- },
17
- overrides: [
18
- {
19
- files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
20
- rules: {
21
- // RATIONALE : Maintain code consistency using prettier settings
22
- 'prettier/prettier': ['error', {}, { usePrettierrc: true }],
23
- },
24
- },
25
- {
26
- files: ['*.ts', '*.tsx'],
27
- rules: {},
28
- },
29
- {
30
- files: ['*.js', '*.jsx'],
31
- rules: {},
32
- },
33
- ],
34
- };
@@ -1,30 +0,0 @@
1
- module.exports = {
2
- // https://www.npmjs.com/package/eslint-plugin-react
3
- // https://github.com/ArnaudBarre/eslint-plugin-react-refresh
4
- // https://www.npmjs.com/package/eslint-plugin-jsx-a11y
5
- plugins: ['react', 'react-refresh', 'jsx-a11y'],
6
- extends: [
7
- 'plugin:react/recommended',
8
- 'plugin:react-hooks/recommended',
9
- 'plugin:react/jsx-runtime',
10
- ],
11
- settings: {
12
- react: {
13
- // Specifies the current React version (e.g. version: '18.2')
14
- // If not specified (default 'detect'), the entire React library will be loaded,
15
- // which may slow down the linting process.
16
- version: 'detect',
17
- },
18
- },
19
- overrides: [],
20
- rules: {
21
- // RATIONALE : Recommend exporting only React components to use the stable Fast Refresh
22
- 'react-refresh/only-export-components': [
23
- 'warn',
24
- {
25
- allowConstantExport: true,
26
- allowExportNames: ['getServerSideProps'],
27
- },
28
- ],
29
- },
30
- };