eslint-config-gorgon 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 weipengzou
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ ### Install
2
+
3
+ ```zsh
4
+ pnpm i -D eslint-config-grogon-lint
5
+ ```
6
+
7
+ ### Start
8
+
9
+ in your eslintrc file
10
+
11
+ ```json
12
+ // .eslintrc
13
+ {
14
+ "extends": ["gorgon-lint"]
15
+ }
16
+ ```
17
+
18
+ ### Why Need
19
+
20
+ - eslint
21
+ - typescript
22
+ - react
23
+ - ...more lint
24
+
25
+ Dont want install more deps ?
26
+
27
+ Just two steps ~
28
+
29
+ 1. `pnpm i -D eslint-config-grogon-lint`
30
+ 2. create `.eslintrc` file and set `"extends": ["gorgon-lint"]`
31
+
32
+ ### How it work
33
+
34
+ [using-a-shareable-configuration-package](https://eslint.org/docs/latest/use/configure/configuration-files#using-a-shareable-configuration-package)
35
+
36
+ ### Desc
37
+
38
+ > just collect recommended eslint, no more custom rules.
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "eslint-config-gorgon",
3
+ "version": "0.0.0",
4
+ "main": "src/index.js",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "airbnb",
8
+ "eslint",
9
+ "config"
10
+ ],
11
+ "files": [
12
+ "src"
13
+ ],
14
+ "dependencies": {
15
+ "@typescript-eslint/eslint-plugin": "^5.55.0",
16
+ "@typescript-eslint/parser": "^5.55.0",
17
+ "eslint-config-airbnb": "^19.0.4",
18
+ "eslint-config-airbnb-typescript": "^17.0.0",
19
+ "eslint-config-prettier": "^8.7.0",
20
+ "eslint-plugin-react-hooks": "^4.6.0",
21
+ "eslint-plugin-simple-import-sort": "^10.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "eslint": "^8.36.0",
25
+ "typescript": "^4.9.5"
26
+ }
27
+ }
package/src/index.js ADDED
@@ -0,0 +1,12 @@
1
+ const extendsList = [
2
+ './rules/base.js',
3
+ './rules/react-hooks.js',
4
+ './rules/imports.js',
5
+ './rules/typescript.js',
6
+ ].map((item) => require.resolve(item));
7
+
8
+ const config = {
9
+ extends: extendsList,
10
+ };
11
+
12
+ module.exports = config;
@@ -0,0 +1,12 @@
1
+ const config = {
2
+ extends: [
3
+ 'airbnb',
4
+ 'airbnb-typescript'
5
+ ],
6
+ rules: {
7
+ // handle console
8
+ 'no-console': 'warn'
9
+ },
10
+ };
11
+
12
+ module.exports = config;
@@ -0,0 +1,9 @@
1
+ const config = {
2
+ plugins: ['simple-import-sort'],
3
+ rules: {
4
+ // handle import
5
+ 'simple-import-sort/imports': 'error',
6
+ 'simple-import-sort/exports': 'error',
7
+ },
8
+ };
9
+ module.exports = config;
@@ -0,0 +1,7 @@
1
+ const config = {
2
+ extends: [
3
+ 'prettier',
4
+ ]
5
+ };
6
+
7
+ module.exports = config;
@@ -0,0 +1,17 @@
1
+ const config = {
2
+ plugins: ['react-hooks'],
3
+ parserOptions: {
4
+ ecmaFeatures: {
5
+ jsx: true,
6
+ },
7
+ },
8
+ rules: {
9
+ // Enforce Rules of Hooks
10
+ // https://github.com/facebook/react/blob/c11015ff4f610ac2924d1fc6d569a17657a404fd/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
11
+ 'react-hooks/rules-of-hooks': 'error',
12
+ // Verify the list of the dependencies for Hooks like useEffect and similar
13
+ // https://github.com/facebook/react/blob/1204c789776cb01fbaf3e9f032e7e2ba85a44137/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
14
+ 'react-hooks/exhaustive-deps': 'error',
15
+ },
16
+ };
17
+ module.exports = config;
@@ -0,0 +1,11 @@
1
+ const config = {
2
+ extends: ['plugin:@typescript-eslint/recommended'],
3
+ parser: '@typescript-eslint/parser',
4
+ plugins: ['@typescript-eslint'],
5
+ rules: {
6
+ // handle unused
7
+ '@typescript-eslint/no-unused-vars': 'error',
8
+ "@typescript-eslint/no-shadow": 'off'
9
+ },
10
+ };
11
+ module.exports = config;