@coko/lint 1.4.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/CHANGELOG.md +9 -0
- package/LICENSE.md +21 -0
- package/README.md +1 -145
- package/package.json +51 -51
- package/src/eslint.js +20 -5
- package/src/lintstaged.js +2 -2
- package/src/stylelint.js +9 -1
- package/.cz-config.js +0 -12
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -7
- package/.prettierrc.js +0 -3
- package/commitlint.config.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.0.0](https://gitlab.coko.foundation/cokoapps/lint/compare/v1.4.0...v2.0.0) (2022-03-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* husky needs a migration to hook files
|
|
11
|
+
|
|
12
|
+
* upgrade dependencies ([7be266a](https://gitlab.coko.foundation/cokoapps/lint/commit/7be266af0d829af54b2d909040643c8439802d2e))
|
|
13
|
+
|
|
5
14
|
## [1.4.0](https://gitlab.coko.foundation///compare/v1.3.0...v1.4.0) (2021-01-09)
|
|
6
15
|
|
|
7
16
|
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Aspiration
|
|
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
CHANGED
|
@@ -1,145 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Features / libraries provided, along with their configuration:
|
|
4
|
-
|
|
5
|
-
- **Eslint**
|
|
6
|
-
- **Stylelint**
|
|
7
|
-
- **Prettier**
|
|
8
|
-
- **Husky** (to provide pre-commit hooks)
|
|
9
|
-
- **Lint-staged** (combined with husky, will run linters on staged code before it is commited)
|
|
10
|
-
- **Commitlint** (to lint the commit message itself)
|
|
11
|
-
- **Commitizen** (to provide the cli helper for the conventional commit standard)
|
|
12
|
-
|
|
13
|
-
To install:
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
yarn add --dev @coko/lint
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
You shouldn't need to install any other dependency.
|
|
20
|
-
Just follow the instructions below.
|
|
21
|
-
|
|
22
|
-
All files below should be added to the root folder of your project, unless otherwise specified, or if you have a specific reason not to.
|
|
23
|
-
|
|
24
|
-
# Eslint
|
|
25
|
-
|
|
26
|
-
Add an `.eslintrc.js` in your root folder:
|
|
27
|
-
|
|
28
|
-
```js
|
|
29
|
-
const { eslint } = require('@coko/lint')
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* You can edit the eslint config file here.
|
|
33
|
-
*
|
|
34
|
-
* eg.
|
|
35
|
-
* eslint.rules['no-console'] = ['warn', { allow: ['error', 'warn'] }],
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
module.exports = eslint
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
# Prettier
|
|
43
|
-
|
|
44
|
-
Add a `.prettierrc.js` file:
|
|
45
|
-
|
|
46
|
-
```js
|
|
47
|
-
const { prettier } = require('@coko/lint')
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* You can edit the config here:
|
|
51
|
-
*
|
|
52
|
-
* eg.
|
|
53
|
-
* prettier.semi = true
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
module.exports = prettier
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
# Stylelint
|
|
61
|
-
|
|
62
|
-
Add a `.stylelintrc.js` file:
|
|
63
|
-
|
|
64
|
-
```js
|
|
65
|
-
const { stylelint } = require('@coko/lint')
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* You can edit the config here:
|
|
69
|
-
*
|
|
70
|
-
* eg.
|
|
71
|
-
* stylelint.rules['your-rule'] = true
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
module.exports = stylelint
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
# Commitlint, Lint staged & Commitizen
|
|
79
|
-
|
|
80
|
-
`commitlint` lints your commits to make sure it follows the conventional commits specification. `lint-staged` will run the linters on changes staged in git. These two will be executed every time a commit is made, with the help of `husky`'s `pre-commit` hook.
|
|
81
|
-
|
|
82
|
-
The following also adds `commitizen`, an interactive cli tool to build valid commits (run it with `yarn cz`).
|
|
83
|
-
|
|
84
|
-
Create a `.commitlintrc.js` file:
|
|
85
|
-
|
|
86
|
-
```js
|
|
87
|
-
module.exports = {
|
|
88
|
-
extends: ['@commitlint/config-conventional'],
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Add a `.lintstagedrc.js` file:
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
const { lintstaged } = require('@coko/lint')
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* You can edit the config here:
|
|
99
|
-
*
|
|
100
|
-
* eg.
|
|
101
|
-
* lintstaged.linters['*.js'] = ['my-custom-linter']
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
module.exports = lintstaged
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Create a `.cz-config.js` file:
|
|
109
|
-
|
|
110
|
-
```js
|
|
111
|
-
const { commitizen } = require('@coko/lint')
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* You can edit the config before you export it to suit your needs.
|
|
115
|
-
*
|
|
116
|
-
* eg.
|
|
117
|
-
* commitizen.scopes = [
|
|
118
|
-
* 'dashboard',
|
|
119
|
-
* 'team manager',
|
|
120
|
-
* 'api',
|
|
121
|
-
* 'models',
|
|
122
|
-
* '*'
|
|
123
|
-
* ]
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
module.exports = commitizen
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Finally, add the following lines to your `package.json`:
|
|
130
|
-
|
|
131
|
-
```json
|
|
132
|
-
"scripts": {
|
|
133
|
-
"cz": "git-cz"
|
|
134
|
-
},
|
|
135
|
-
"config": {
|
|
136
|
-
"commitizen": {
|
|
137
|
-
"path": "cz-customizable"
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
"husky": {
|
|
141
|
-
"hooks": {
|
|
142
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS && lint-staged"
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
```
|
|
1
|
+
Documentation can be found [here](https://dev.coko.foundation/?path=/docs/common-libraries-lint--page).
|
package/package.json
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coko/lint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Linter configurations and dependencies for coko's projects",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"cz": "git-cz",
|
|
8
|
-
"release": "standard-version",
|
|
9
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
-
},
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git@gitlab.coko.foundation:cokoapps/lint.git"
|
|
14
|
-
},
|
|
15
5
|
"keywords": [
|
|
16
6
|
"lint",
|
|
17
7
|
"pubsweet",
|
|
18
8
|
"coko"
|
|
19
9
|
],
|
|
20
|
-
"
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git@gitlab.coko.foundation:cokoapps/lint.git"
|
|
13
|
+
},
|
|
21
14
|
"license": "MIT",
|
|
22
|
-
"
|
|
23
|
-
|
|
15
|
+
"author": "Yannis Barlas",
|
|
16
|
+
"main": "src/index.js",
|
|
17
|
+
"files": [
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"cz": "git-cz",
|
|
22
|
+
"prepare": "husky install",
|
|
23
|
+
"release": "standard-version",
|
|
24
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
25
|
+
},
|
|
26
|
+
"config": {
|
|
27
|
+
"commitizen": {
|
|
28
|
+
"path": "cz-customizable"
|
|
29
|
+
}
|
|
24
30
|
},
|
|
25
31
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"babel-
|
|
29
|
-
"
|
|
32
|
+
"@babel/core": "^7.17.7",
|
|
33
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
34
|
+
"@babel/preset-react": "^7.16.7",
|
|
35
|
+
"@commitlint/cli": "^16.2.3",
|
|
36
|
+
"@commitlint/config-conventional": "^16.2.1",
|
|
37
|
+
"commitizen": "^4.2.4",
|
|
30
38
|
"conventional-commit-types": "^3.0.0",
|
|
31
|
-
"cz-conventional-changelog": "^3.
|
|
32
|
-
"cz-customizable": "^6.
|
|
33
|
-
"eslint": "^
|
|
34
|
-
"eslint-config-airbnb": "^
|
|
35
|
-
"eslint-config-prettier": "^
|
|
36
|
-
"eslint-config-standard": "^
|
|
37
|
-
"eslint-config-standard-react": "^
|
|
38
|
-
"eslint-plugin-cypress": "^2.
|
|
39
|
-
"eslint-plugin-import": "^2.
|
|
40
|
-
"eslint-plugin-jest": "^
|
|
41
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
42
|
-
"eslint-plugin-node": "^11.
|
|
43
|
-
"eslint-plugin-
|
|
44
|
-
"eslint-plugin-
|
|
45
|
-
"eslint-plugin-react": "^
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"husky": "^4.2.3",
|
|
49
|
-
"lint-staged": "^10.4.2",
|
|
39
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
40
|
+
"cz-customizable": "^6.3.0",
|
|
41
|
+
"eslint": "^8.11.0",
|
|
42
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
43
|
+
"eslint-config-prettier": "^8.5.0",
|
|
44
|
+
"eslint-config-standard": "^16.0.3",
|
|
45
|
+
"eslint-config-standard-react": "^11.0.1",
|
|
46
|
+
"eslint-plugin-cypress": "^2.12.1",
|
|
47
|
+
"eslint-plugin-import": "^2.25.4",
|
|
48
|
+
"eslint-plugin-jest": "^26.1.1",
|
|
49
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
50
|
+
"eslint-plugin-node": "^11.1.0",
|
|
51
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
52
|
+
"eslint-plugin-react": "^7.29.4",
|
|
53
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
54
|
+
"husky": "^7.0.4",
|
|
55
|
+
"lint-staged": "^12.3.7",
|
|
50
56
|
"longest": "^2.0.1",
|
|
51
|
-
"
|
|
57
|
+
"postcss-scss": "^4.0.3",
|
|
58
|
+
"prettier": "^2.6.0",
|
|
52
59
|
"right-pad": "^1.0.1",
|
|
53
|
-
"stylelint": "^
|
|
54
|
-
"stylelint-config-
|
|
60
|
+
"stylelint": "^14.6.0",
|
|
61
|
+
"stylelint-config-standard-scss": "^3.0.0",
|
|
55
62
|
"stylelint-config-styled-components": "^0.1.1",
|
|
56
|
-
"stylelint-order": "^
|
|
63
|
+
"stylelint-order": "^5.0.0",
|
|
57
64
|
"stylelint-processor-styled-components": "^1.10.0"
|
|
58
65
|
},
|
|
59
66
|
"devDependencies": {
|
|
60
|
-
"standard-version": "^
|
|
67
|
+
"standard-version": "^9.3.2"
|
|
61
68
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"path": "cz-customizable"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"husky": {
|
|
68
|
-
"hooks": {
|
|
69
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
70
|
-
}
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/src/eslint.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
parser: 'babel-
|
|
2
|
+
parser: '@babel/eslint-parser',
|
|
3
|
+
parserOptions: {
|
|
4
|
+
requireConfigFile: false,
|
|
5
|
+
babelOptions: {
|
|
6
|
+
presets: ['@babel/preset-react'],
|
|
7
|
+
},
|
|
8
|
+
},
|
|
3
9
|
env: {
|
|
4
10
|
browser: true,
|
|
5
11
|
es6: true,
|
|
@@ -13,10 +19,8 @@ module.exports = {
|
|
|
13
19
|
'plugin:jest/recommended',
|
|
14
20
|
'plugin:cypress/recommended',
|
|
15
21
|
'prettier',
|
|
16
|
-
'prettier/react',
|
|
17
|
-
'prettier/standard',
|
|
18
22
|
],
|
|
19
|
-
plugins: ['jest'
|
|
23
|
+
plugins: ['jest'],
|
|
20
24
|
ignorePatterns: [
|
|
21
25
|
'_build',
|
|
22
26
|
'dist',
|
|
@@ -28,8 +32,10 @@ module.exports = {
|
|
|
28
32
|
'!.lintstagedrc.js',
|
|
29
33
|
'!.prettierrc.js',
|
|
30
34
|
'!.stylelintrc.js',
|
|
35
|
+
'**/node_modules',
|
|
31
36
|
],
|
|
32
37
|
rules: {
|
|
38
|
+
'arrow-body-style': 0,
|
|
33
39
|
'import/no-extraneous-dependencies': [
|
|
34
40
|
'error',
|
|
35
41
|
{
|
|
@@ -37,12 +43,15 @@ module.exports = {
|
|
|
37
43
|
// storybook
|
|
38
44
|
'.storybook/*',
|
|
39
45
|
'**/stories/**/*.js',
|
|
46
|
+
|
|
40
47
|
// tests
|
|
41
48
|
'cypress/**',
|
|
42
49
|
'**/*.spec.js',
|
|
43
50
|
'**/*.test.js',
|
|
51
|
+
|
|
44
52
|
// webpack
|
|
45
53
|
'webpack/**',
|
|
54
|
+
|
|
46
55
|
// configs
|
|
47
56
|
'.commitlintrc.js',
|
|
48
57
|
'.cz-config.js',
|
|
@@ -51,6 +60,7 @@ module.exports = {
|
|
|
51
60
|
'.lintstagedrc.js',
|
|
52
61
|
'.prettierrc.js',
|
|
53
62
|
'.stylelintrc.js',
|
|
63
|
+
|
|
54
64
|
// other
|
|
55
65
|
'dev/**',
|
|
56
66
|
],
|
|
@@ -74,8 +84,13 @@ module.exports = {
|
|
|
74
84
|
{ blankLine: 'always', prev: '*', next: 'multiline-const' },
|
|
75
85
|
{ blankLine: 'always', prev: 'multiline-const', next: '*' },
|
|
76
86
|
],
|
|
77
|
-
'prettier/prettier': 'error',
|
|
87
|
+
// 'prettier/prettier': 'error',
|
|
88
|
+
'react/function-component-definition': [
|
|
89
|
+
2,
|
|
90
|
+
{ namedComponents: 'arrow-function' },
|
|
91
|
+
],
|
|
78
92
|
'react/jsx-filename-extension': [2, { extensions: ['.js'] }], // disallows .jsx files
|
|
93
|
+
'react/jsx-props-no-spreading': 0,
|
|
79
94
|
'react/jsx-sort-props': [1, { ignoreCase: true }],
|
|
80
95
|
'react/prop-types': [
|
|
81
96
|
2,
|
package/src/lintstaged.js
CHANGED
package/src/stylelint.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
extends: [
|
|
3
|
-
'stylelint-config-
|
|
3
|
+
'stylelint-config-standard-scss',
|
|
4
4
|
'stylelint-config-styled-components',
|
|
5
5
|
],
|
|
6
|
+
customSyntax: 'postcss-scss',
|
|
6
7
|
ignoreFiles: ['_build'],
|
|
7
8
|
plugins: ['stylelint-order'],
|
|
8
9
|
processors: ['stylelint-processor-styled-components'],
|
|
@@ -15,5 +16,12 @@ module.exports = {
|
|
|
15
16
|
'always',
|
|
16
17
|
{ ignore: ['first-nested', 'after-comment'] },
|
|
17
18
|
],
|
|
19
|
+
|
|
20
|
+
'value-keyword-case': null,
|
|
21
|
+
'comment-empty-line-before': null,
|
|
22
|
+
'declaration-colon-newline-after': null,
|
|
23
|
+
'keyframes-name-pattern': null,
|
|
24
|
+
'declaration-empty-line-before': null,
|
|
25
|
+
'selector-class-pattern': null,
|
|
18
26
|
},
|
|
19
27
|
}
|
package/.cz-config.js
DELETED
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
package/.prettierrc.js
DELETED
package/commitlint.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = { extends: ['@commitlint/config-conventional'] }
|