airier 0.0.1 → 0.0.3
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/.eslintrc.js +2 -2
- package/.eslintrc.onlystyles.example.js +2 -2
- package/README.md +13 -17
- package/index.js +5 -6
- package/modules/eslint_config.js +6 -12
- package/modules/styleguide.js +5 -1
- package/package.json +4 -3
- package/.npmrc.bak +0 -1
package/.eslintrc.js
CHANGED
package/README.md
CHANGED
|
@@ -4,32 +4,28 @@ A shared set of standards and preferences, enforced through eslint and vscode. P
|
|
|
4
4
|
|
|
5
5
|
## Quickstart
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
1. Copy `.babelrc` to your project's `.babelrc`
|
|
12
|
-
1. Copy `.vscode/settings.json` to your project's `.vscode/settings.json`
|
|
13
|
-
1. Copy `.husky/pre-commit` to your project's `.husky/pre-commit`
|
|
14
|
-
1. Run husky initial setup
|
|
7
|
+
```shell
|
|
8
|
+
# Install dependencies
|
|
9
|
+
npm install -D airier @babel/eslint-parser @babel/preset-react eslint eslint-plugin-react eslint-plugin-unused-imports husky
|
|
10
|
+
mkdir .vscode .husky || echo "Directories already exist"
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
# Create scripts
|
|
13
|
+
npm pkg set scripts.lint="eslint --fix src"
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
mkdir .vscode .husky
|
|
15
|
+
# Init husky
|
|
16
|
+
npx husky init
|
|
21
17
|
|
|
22
18
|
# Download files
|
|
23
19
|
curl https://raw.githubusercontent.com/actuallymentor/airier/main/.eslintrc.js --output .eslintrc.js
|
|
24
20
|
curl https://raw.githubusercontent.com/actuallymentor/airier/main/.vscode/settings.json --output .vscode/settings.json
|
|
25
21
|
curl https://raw.githubusercontent.com/actuallymentor/airier/main/.husky/pre-commit --output .husky/pre-commit
|
|
26
22
|
curl https://raw.githubusercontent.com/actuallymentor/airier/main/.babelrc --output .babelrc
|
|
23
|
+
|
|
24
|
+
# Add files to git
|
|
27
25
|
git add -f .eslintrc.js .babelrc .vscode/* .husky/*
|
|
26
|
+
|
|
27
|
+
# Make husky executable
|
|
28
28
|
chmod ug+x .husky/*
|
|
29
|
-
npm pkg set scripts.prepare="husky install"
|
|
30
|
-
npm pkg set scripts.lint="eslint --fix src"
|
|
31
|
-
npm run prepare
|
|
32
|
-
npx husky add .husky/pre-commit
|
|
33
29
|
git add .husky/pre-commit
|
|
34
30
|
```
|
|
35
31
|
|
|
@@ -45,6 +41,6 @@ The relevant source files are in `modules/`. If you make a change, you can updat
|
|
|
45
41
|
|
|
46
42
|
If you are cloning this repo and want to reuse it to create an npm package. These are the one-time setup instructions:
|
|
47
43
|
|
|
48
|
-
1. You need to do the one-time first publishing manually by running `npm publish --access public` in the root of the project. This will create the package on npmjs and allow you to create a granular token.
|
|
44
|
+
1. You need to do the one-time first publishing manually by running `npm publish --access public` in the root of the project. This will create the package on npmjs and allow you to create a granular token. This requires you to rename `.npmrc` to `.npmrc.bak` temporatily.
|
|
49
45
|
1. You need to obtain a NPM_ACCESS_TOKEN on npmjs (https://www.npmjs.com/settings/YOURUSERNAME/tokens/granular-access-tokens/new). Note that granular tokens expire!
|
|
50
46
|
# airier
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Import the modules using ES Module syntax
|
|
2
|
+
import eslint_config from './modules/eslint_config.js'
|
|
3
|
+
import styleguide from './modules/styleguide.js'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
styleguide
|
|
7
|
-
}
|
|
5
|
+
// Export the objects in an object literal
|
|
6
|
+
export { eslint_config, styleguide }
|
package/modules/eslint_config.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// Import the styleguide module using ES Module syntax
|
|
2
|
+
import styleguide from './styleguide.js'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
// Export the configuration object using `export default`
|
|
5
|
+
export default {
|
|
4
6
|
|
|
5
7
|
// Recommended features
|
|
6
8
|
"extends": [ "eslint:recommended", "plugin:react/recommended" ],
|
|
@@ -24,15 +26,8 @@ module.exports = {
|
|
|
24
26
|
|
|
25
27
|
// Rules
|
|
26
28
|
rules: {
|
|
27
|
-
|
|
28
29
|
// Import styleguide
|
|
29
|
-
...styleguide
|
|
30
|
-
|
|
31
|
-
// React config
|
|
32
|
-
"react/no-unescaped-entities": 0,
|
|
33
|
-
"react/react-in-jsx-scope": 0, // CRA globally imports "react" so we don't need to do it
|
|
34
|
-
"react/prop-types": 0,
|
|
35
|
-
"react/display-name": 0
|
|
30
|
+
...styleguide
|
|
36
31
|
},
|
|
37
32
|
|
|
38
33
|
// What environment to run in
|
|
@@ -52,5 +47,4 @@ module.exports = {
|
|
|
52
47
|
Cypress: true,
|
|
53
48
|
expect: true
|
|
54
49
|
}
|
|
55
|
-
|
|
56
|
-
}
|
|
50
|
+
}
|
package/modules/styleguide.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// warn: we recomment this to change, but there are instances where you can choose to ignore it
|
|
4
4
|
// error: there is no reason for you to do this
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export default {
|
|
7
7
|
|
|
8
8
|
/* ///////////////////////////////
|
|
9
9
|
// Built-in rules
|
|
@@ -83,6 +83,10 @@ module.exports = {
|
|
|
83
83
|
"react/jsx-indent": "warn",
|
|
84
84
|
"react/jsx-indent-props": "warn",
|
|
85
85
|
"react/jsx-no-useless-fragment": "error",
|
|
86
|
+
"react/no-unescaped-entities": 0,
|
|
87
|
+
"react/react-in-jsx-scope": 0, // CRA globally imports "react" so we don't need to do it
|
|
88
|
+
"react/prop-types": 0,
|
|
89
|
+
"react/display-name": 0,
|
|
86
90
|
|
|
87
91
|
/* ///////////////////////////////
|
|
88
92
|
// Plugins
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "airier",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Opinionated Eslint and VSCode style guide",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
9
|
},
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
"url": "https://github.com/actuallymentor/airier/issues"
|
|
17
18
|
},
|
|
18
19
|
"homepage": "https://github.com/actuallymentor/airier#readme",
|
|
19
|
-
"
|
|
20
|
+
"peerDependencies": {
|
|
20
21
|
"eslint-plugin-unused-imports": "^3.1.0"
|
|
21
22
|
}
|
|
22
|
-
}
|
|
23
|
+
}
|
package/.npmrc.bak
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}
|