eslint-config-instant 1.1.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/LICENSE +21 -0
- package/README.MD +81 -0
- package/index.js +57 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Instant Commerce
|
|
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,81 @@
|
|
|
1
|
+
# ⚙️ eslint-config-instant
|
|
2
|
+
|
|
3
|
+
A shareable eslint config used in projects created by Instant Commerce. The eslint config relies on several eslint plugins and implements prettier as a rule set.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Start by removing any .eslintrc or .prettierrc files in your project. (**Note that eslintignore and prettierignore are still needed per project**)
|
|
8
|
+
|
|
9
|
+
Once done, drop the following line in your favorite terminal:
|
|
10
|
+
|
|
11
|
+
For frontend:
|
|
12
|
+
```bash
|
|
13
|
+
yarn add -D eslint-config-instant eslint eslint-config-prettier eslint-plugin-jsx-a11y eslint-plugin-prettier eslint-plugin-react eslint-plugin-import eslint-import-resolver-alias eslint-plugin-react-hooks eslint-plugin-mdx prettier
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For backend:
|
|
17
|
+
```bash
|
|
18
|
+
yarn add -D eslint eslint-config-prettier eslint-import-resolver-alias eslint-plugin-import eslint-plugin-prettier
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Finally add this to your package.json
|
|
22
|
+
Various available packages are:
|
|
23
|
+
|
|
24
|
+
- instant
|
|
25
|
+
For libraries/packages/etc where /react or /backend is overkill
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
"eslintConfig": {
|
|
29
|
+
"extends": [
|
|
30
|
+
"instant"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- instant/react
|
|
36
|
+
For all things frontend
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
"eslintConfig": {
|
|
40
|
+
"extends": [
|
|
41
|
+
"instant/react"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- instant/backend
|
|
47
|
+
For all things backend
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
"eslintConfig": {
|
|
51
|
+
"extends": [
|
|
52
|
+
"instant/backend"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## formatOnSave With VS Code
|
|
58
|
+
|
|
59
|
+
Once you have installed the eslint-config, you probably want your editor to lint and fix for you.
|
|
60
|
+
Here are the instructions for VS Code:
|
|
61
|
+
|
|
62
|
+
1. Install the [ESLint package](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
63
|
+
2. Now we need to setup some VS Code settings via `Code/File` → `Preferences` → `Settings`. It's easier to enter these settings while editing the `settings.json` file, so click the `{}` icon in the top right corner:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
// These are all my auto-save configs
|
|
67
|
+
"editor.formatOnSave": true,
|
|
68
|
+
// turn it off for JS and JSX, we will do this via eslint
|
|
69
|
+
"[javascript]": {
|
|
70
|
+
"editor.formatOnSave": false
|
|
71
|
+
},
|
|
72
|
+
"[javascriptreact]": {
|
|
73
|
+
"editor.formatOnSave": false
|
|
74
|
+
},
|
|
75
|
+
// tell the ESLint plugin to run on save
|
|
76
|
+
"editor.codeActionsOnSave": {
|
|
77
|
+
"source.fixAll": true
|
|
78
|
+
},
|
|
79
|
+
// Optional BUT IMPORTANT: If you have the prettier extension enabled for other languages like CSS and HTML, turn it off for JS since we are doing it through Eslint already
|
|
80
|
+
"prettier.disableLanguages": ["javascript", "javascriptreact"],
|
|
81
|
+
```
|
package/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ['prettier'],
|
|
3
|
+
plugins: ['@typescript-eslint', 'import', 'prettier'],
|
|
4
|
+
settings: {
|
|
5
|
+
'import/resolver': {
|
|
6
|
+
node: {
|
|
7
|
+
extensions: ['.js', '.ts'],
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
'import/parsers': {
|
|
11
|
+
'@typescript-eslint/parser': ['.ts'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
// come up with some nice rules here
|
|
16
|
+
|
|
17
|
+
'import/order': [
|
|
18
|
+
'error',
|
|
19
|
+
{
|
|
20
|
+
alphabetize: {
|
|
21
|
+
order: 'asc',
|
|
22
|
+
caseInsensitive: true,
|
|
23
|
+
},
|
|
24
|
+
groups: ['builtin', 'external', ['internal', 'parent'], ['sibling', 'index']],
|
|
25
|
+
pathGroups: [
|
|
26
|
+
{
|
|
27
|
+
pattern: 'react',
|
|
28
|
+
group: 'external',
|
|
29
|
+
position: 'before',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
pattern: '~**',
|
|
33
|
+
group: 'internal',
|
|
34
|
+
position: 'before',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
pattern: '~**/**',
|
|
38
|
+
group: 'internal',
|
|
39
|
+
position: 'before',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
pathGroupsExcludedImportTypes: [],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
'prettier/prettier': [
|
|
46
|
+
'error',
|
|
47
|
+
{
|
|
48
|
+
printWidth: 100,
|
|
49
|
+
semi: true,
|
|
50
|
+
singleQuote: true,
|
|
51
|
+
tabWidth: 2,
|
|
52
|
+
trailingComma: 'all',
|
|
53
|
+
useTabs: false,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-config-instant",
|
|
3
|
+
"version": "1.1.8",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"files": [
|
|
6
|
+
"index.js",
|
|
7
|
+
"web.js",
|
|
8
|
+
"node.js"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"lint": "eslint .",
|
|
12
|
+
"lint:fix": "eslint --fix",
|
|
13
|
+
"commit": "./node_modules/cz-customizable/standalone.js",
|
|
14
|
+
"semantic-release": "semantic-release"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"eslint": "8.17.0",
|
|
18
|
+
"eslint-config-prettier": "8.5.0",
|
|
19
|
+
"eslint-import-resolver-alias": "1.1.2",
|
|
20
|
+
"eslint-plugin-import": "2.26.0",
|
|
21
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
22
|
+
"prettier": "2.6.2",
|
|
23
|
+
"typescript": "4.7.3"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@commitlint/cli": "17.0.2",
|
|
27
|
+
"@commitlint/config-conventional": "17.0.2",
|
|
28
|
+
"@semantic-release/changelog": "6.0.1",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "5.27.0",
|
|
30
|
+
"@typescript-eslint/parser": "5.27.0",
|
|
31
|
+
"cz-customizable": "git+https://github.com/storyofams/tools-cz-customizable.git#v6.3.2",
|
|
32
|
+
"eslint": "8.17.0",
|
|
33
|
+
"eslint-config-prettier": "8.5.0",
|
|
34
|
+
"eslint-import-resolver-alias": "1.1.2",
|
|
35
|
+
"eslint-plugin-import": "2.26.0",
|
|
36
|
+
"eslint-plugin-jest": "26.5.3",
|
|
37
|
+
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
38
|
+
"eslint-plugin-mdx": "1.17.0",
|
|
39
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
40
|
+
"eslint-plugin-react": "7.30.0",
|
|
41
|
+
"eslint-plugin-react-hooks": "4.5.0",
|
|
42
|
+
"prettier": "2.6.2",
|
|
43
|
+
"semantic-release": "19.0.2",
|
|
44
|
+
"typescript": "4.7.3"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"eslintConfig": {
|
|
51
|
+
"extends": [
|
|
52
|
+
"./index.js"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"config": {
|
|
56
|
+
"commitizen": {
|
|
57
|
+
"path": "node_modules/cz-customizable"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|