@coko/lint 1.2.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 CHANGED
@@ -2,6 +2,30 @@
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
+
14
+ ## [1.4.0](https://gitlab.coko.foundation///compare/v1.3.0...v1.4.0) (2021-01-09)
15
+
16
+
17
+ ### Features
18
+
19
+ * **eslint:** allow devdepencies in dev folder, ignore dist folder ([55b30cc](https://gitlab.coko.foundation///commit/55b30cc4d4ca764339771a26354a783cb8690de6))
20
+
21
+ ## [1.3.0](https://gitlab.coko.foundation///compare/v1.2.0...v1.3.0) (2020-12-13)
22
+
23
+
24
+ ### Features
25
+
26
+ * **eslint:** make console.log an error ([fa4aca8](https://gitlab.coko.foundation///commit/fa4aca8d4e83b638e74da5acf3c98516e6e79ee6))
27
+ * **stylelint:** add build to ignore patterns ([efe8e1f](https://gitlab.coko.foundation///commit/efe8e1f7c16145138335b673f4701cbaaa6f6466))
28
+
5
29
  ## [1.2.0](https://gitlab.coko.foundation///compare/v1.1.0...v1.2.0) (2020-12-13)
6
30
 
7
31
 
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
- This package provides everything that is needed to lint applications built by the Coko team.
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": "1.2.0",
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
- "author": "Yannis Barlas",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git@gitlab.coko.foundation:cokoapps/lint.git"
13
+ },
21
14
  "license": "MIT",
22
- "publishConfig": {
23
- "access": "public"
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
- "@commitlint/cli": "^8.3.5",
27
- "@commitlint/config-conventional": "^8.3.4",
28
- "babel-eslint": "^10.1.0",
29
- "commitizen": "^4.0.3",
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.1.0",
32
- "cz-customizable": "^6.2.0",
33
- "eslint": "^6.8.0",
34
- "eslint-config-airbnb": "^18.1.0",
35
- "eslint-config-prettier": "^6.10.1",
36
- "eslint-config-standard": "^14.1.1",
37
- "eslint-config-standard-react": "^9.2.0",
38
- "eslint-plugin-cypress": "^2.11.2",
39
- "eslint-plugin-import": "^2.20.1",
40
- "eslint-plugin-jest": "^23.8.2",
41
- "eslint-plugin-jsx-a11y": "^6.2.3",
42
- "eslint-plugin-node": "^11.0.0",
43
- "eslint-plugin-prettier": "^3.1.2",
44
- "eslint-plugin-promise": "^4.2.1",
45
- "eslint-plugin-react": "^7.19.0",
46
- "eslint-plugin-react-hooks": "^2.5.1",
47
- "eslint-plugin-standard": "^4.0.1",
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
- "prettier": "^2.0.2",
57
+ "postcss-scss": "^4.0.3",
58
+ "prettier": "^2.6.0",
52
59
  "right-pad": "^1.0.1",
53
- "stylelint": "^13.7.2",
54
- "stylelint-config-recommended": "^3.0.0",
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": "^4.1.0",
63
+ "stylelint-order": "^5.0.0",
57
64
  "stylelint-processor-styled-components": "^1.10.0"
58
65
  },
59
66
  "devDependencies": {
60
- "standard-version": "^7.1.0"
67
+ "standard-version": "^9.3.2"
61
68
  },
62
- "config": {
63
- "commitizen": {
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-eslint',
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,12 +19,11 @@ 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', 'prettier'],
23
+ plugins: ['jest'],
20
24
  ignorePatterns: [
21
25
  '_build',
26
+ 'dist',
22
27
  '!.storybook',
23
28
  '!.commitlintrc.js',
24
29
  '!.cz-config.js',
@@ -27,8 +32,10 @@ module.exports = {
27
32
  '!.lintstagedrc.js',
28
33
  '!.prettierrc.js',
29
34
  '!.stylelintrc.js',
35
+ '**/node_modules',
30
36
  ],
31
37
  rules: {
38
+ 'arrow-body-style': 0,
32
39
  'import/no-extraneous-dependencies': [
33
40
  'error',
34
41
  {
@@ -36,12 +43,15 @@ module.exports = {
36
43
  // storybook
37
44
  '.storybook/*',
38
45
  '**/stories/**/*.js',
46
+
39
47
  // tests
40
48
  'cypress/**',
41
49
  '**/*.spec.js',
42
50
  '**/*.test.js',
51
+
43
52
  // webpack
44
53
  'webpack/**',
54
+
45
55
  // configs
46
56
  '.commitlintrc.js',
47
57
  '.cz-config.js',
@@ -50,6 +60,9 @@ module.exports = {
50
60
  '.lintstagedrc.js',
51
61
  '.prettierrc.js',
52
62
  '.stylelintrc.js',
63
+
64
+ // other
65
+ 'dev/**',
53
66
  ],
54
67
  },
55
68
  ],
@@ -61,6 +74,7 @@ module.exports = {
61
74
  aspects: ['noHref', 'invalidHref', 'preferButton'],
62
75
  },
63
76
  ],
77
+ 'no-console': ['error', { allow: ['warn', 'error'] }],
64
78
  'padding-line-between-statements': [
65
79
  'error',
66
80
  { blankLine: 'always', prev: '*', next: 'block' },
@@ -70,8 +84,13 @@ module.exports = {
70
84
  { blankLine: 'always', prev: '*', next: 'multiline-const' },
71
85
  { blankLine: 'always', prev: 'multiline-const', next: '*' },
72
86
  ],
73
- 'prettier/prettier': 'error',
87
+ // 'prettier/prettier': 'error',
88
+ 'react/function-component-definition': [
89
+ 2,
90
+ { namedComponents: 'arrow-function' },
91
+ ],
74
92
  'react/jsx-filename-extension': [2, { extensions: ['.js'] }], // disallows .jsx files
93
+ 'react/jsx-props-no-spreading': 0,
75
94
  'react/jsx-sort-props': [1, { ignoreCase: true }],
76
95
  'react/prop-types': [
77
96
  2,
package/src/lintstaged.js CHANGED
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
- '*.js': ['eslint --fix', 'stylelint'],
3
- '*.{js,graphql,json,yml,md,html}': ['prettier --write'],
2
+ '*.js': ['eslint', 'stylelint'],
3
+ '*.{js,graphql,json,yml,md,html}': ['prettier --check'],
4
4
  }
package/src/stylelint.js CHANGED
@@ -1,8 +1,10 @@
1
1
  module.exports = {
2
2
  extends: [
3
- 'stylelint-config-recommended',
3
+ 'stylelint-config-standard-scss',
4
4
  'stylelint-config-styled-components',
5
5
  ],
6
+ customSyntax: 'postcss-scss',
7
+ ignoreFiles: ['_build'],
6
8
  plugins: ['stylelint-order'],
7
9
  processors: ['stylelint-processor-styled-components'],
8
10
  rules: {
@@ -14,5 +16,12 @@ module.exports = {
14
16
  'always',
15
17
  { ignore: ['first-nested', 'after-comment'] },
16
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,
17
26
  },
18
27
  }
package/.cz-config.js DELETED
@@ -1,12 +0,0 @@
1
- const commitizenConfig = require('./src/commitizen')
2
-
3
- commitizenConfig.scopes = [
4
- 'eslint',
5
- 'prettier',
6
- 'stylelint',
7
- 'commitlint',
8
- 'lintstaged',
9
- '*',
10
- ]
11
-
12
- module.exports = commitizenConfig
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- !.cz-config.js
2
- !.eslintrc.js
package/.eslintrc.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: ['airbnb', 'standard', 'prettier', 'prettier/standard'],
3
- plugins: ['prettier'],
4
- rules: {
5
- 'prettier/prettier': 'error',
6
- },
7
- }
package/.prettierrc.js DELETED
@@ -1,3 +0,0 @@
1
- const prettier = require('./src/prettier')
2
-
3
- module.exports = prettier
@@ -1 +0,0 @@
1
- module.exports = { extends: ['@commitlint/config-conventional'] }