@cabify/eslint-config 1.0.2 → 1.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/.github/workflows/npm-publish.yml +7 -24
- package/.github/workflows/tests.yml +2 -18
- package/CHANGELOG.md +6 -0
- package/README.md +47 -8
- package/package.json +7 -5
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
|
3
|
-
|
|
4
1
|
name: Publish package
|
|
5
2
|
|
|
6
3
|
on:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
branches: [main]
|
|
10
|
-
types:
|
|
11
|
-
- completed
|
|
12
|
-
push:
|
|
13
|
-
branches:
|
|
14
|
-
- '!*'
|
|
15
|
-
tags:
|
|
16
|
-
- 'v*'
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
17
6
|
|
|
18
7
|
jobs:
|
|
19
8
|
publish-npm:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
with:
|
|
26
|
-
node-version: ${{ matrix.node-version }}
|
|
27
|
-
cache: 'yarn'
|
|
28
|
-
- uses: JS-DevTools/npm-publish@v1
|
|
29
|
-
with:
|
|
30
|
-
token: ${{ secrets.NPM_TOKEN }}
|
|
9
|
+
uses: cabify/javascript-actions/.github/workflows/npm_publish.yml@main
|
|
10
|
+
with:
|
|
11
|
+
tag: ${{ contains(github.ref_name,'beta') && 'beta' || 'latest' }}
|
|
12
|
+
secrets:
|
|
13
|
+
token: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
-
|
|
4
1
|
name: Tests
|
|
5
2
|
|
|
6
|
-
on: [push
|
|
3
|
+
on: [push]
|
|
7
4
|
|
|
8
5
|
jobs:
|
|
9
6
|
test:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
15
|
-
uses: actions/setup-node@v2
|
|
16
|
-
with:
|
|
17
|
-
node-version: 14.x
|
|
18
|
-
cache: 'yarn'
|
|
19
|
-
- run: yarn install
|
|
20
|
-
- name: Run Lint
|
|
21
|
-
run: yarn lint:check
|
|
22
|
-
- name: Run Format
|
|
23
|
-
run: yarn format:check
|
|
7
|
+
uses: cabify/javascript-actions/.github/workflows/tests.yml@main
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -169,6 +169,8 @@ some rules. If you can live without them, just make these changes in your `.esli
|
|
|
169
169
|
|
|
170
170
|
If you use Jest, installing its import resolver into your project is encouraged.
|
|
171
171
|
|
|
172
|
+
1. Install the following dependencies:
|
|
173
|
+
|
|
172
174
|
```sh
|
|
173
175
|
npm i -D eslint-import-resolver-jest
|
|
174
176
|
```
|
|
@@ -179,6 +181,42 @@ or
|
|
|
179
181
|
yarn add --dev eslint-import-resolver-jest
|
|
180
182
|
```
|
|
181
183
|
|
|
184
|
+
2. Modify `.eslintrc`:
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
...
|
|
189
|
+
"settings": {
|
|
190
|
+
...
|
|
191
|
+
"import/resolver": {
|
|
192
|
+
...
|
|
193
|
+
"jest": {
|
|
194
|
+
"jestConfigFile": "./jest.config.js"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
If you want to ensure that this resolver only applies to your test files, you can use ESLint's overrides configuration option:
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
"overrides": [
|
|
205
|
+
{
|
|
206
|
+
"files": ["**/__tests__/**/*.js"],
|
|
207
|
+
"settings": {
|
|
208
|
+
"import/resolver": {
|
|
209
|
+
"jest": {
|
|
210
|
+
"jestConfigFile": "./jest.config.js"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
3. Make sure that you have set up your jest config file (e.g., `./jest.config.js` )
|
|
219
|
+
|
|
182
220
|
## Legacy
|
|
183
221
|
|
|
184
222
|
If you want to maintain the formatting within ESLint, you can opt to extend the `@cabify/eslint-config/legacy` configuration instead of `@cabify/eslint-config/recommended`:
|
|
@@ -190,15 +228,16 @@ If you want to maintain the formatting within ESLint, you can opt to extend the
|
|
|
190
228
|
}
|
|
191
229
|
```
|
|
192
230
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
Just merge to `main` branch and run:
|
|
231
|
+
### Publish a new version
|
|
196
232
|
|
|
197
|
-
-
|
|
198
|
-
- `
|
|
199
|
-
- `yarn`
|
|
200
|
-
- `
|
|
201
|
-
-
|
|
233
|
+
- Update [CHANGELOG](./CHANGELOG.md) with new features, breaking changes, etc
|
|
234
|
+
- Check you're in `main` branch and everything is up-to-date.
|
|
235
|
+
- Run `yarn publish:<major|minor|patch>` or `yarn publish:canary` for canary versions.
|
|
236
|
+
- Run `git push && git push --tags`
|
|
237
|
+
- Check all test actions triggered after previous push are ✔️.
|
|
238
|
+
- Go to [create a new release](https://github.com/cabify/eslint-config/releases/new), select previously pushed tag and write a Title.
|
|
239
|
+
- Check the action for publish the npm has finished with success.
|
|
240
|
+
- [Check on npm package webpage](https://www.npmjs.com/package/@cabify/eslint-config), the version has been published successfully under `latest` tag.
|
|
202
241
|
|
|
203
242
|
This will trigger a workflow on Github which will publish to npm eventually.
|
|
204
243
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabify/eslint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "ESLint config for Cabify Javascript projects",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "npm run lint:check && npm run format:check",
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
"lint:check": "eslint .",
|
|
9
9
|
"format": "prettier --write .",
|
|
10
10
|
"format:check": "prettier --check .",
|
|
11
|
+
"typecheck": "echo 'No typecheck to perform'",
|
|
12
|
+
"test:ci": "echo 'No test to perform'",
|
|
11
13
|
"publish:major": "npm version major",
|
|
12
14
|
"publish:minor": "npm version minor",
|
|
13
15
|
"publish:patch": "npm version patch",
|
|
14
|
-
"publish:canary": "npm version prerelease"
|
|
16
|
+
"publish:canary": "npm version prerelease --preid=beta"
|
|
15
17
|
},
|
|
16
18
|
"license": "Apache-2.0",
|
|
17
19
|
"repository": "github:cabify/eslint-config",
|
|
@@ -42,7 +44,7 @@
|
|
|
42
44
|
"confusing-browser-globals": "^1.0.10",
|
|
43
45
|
"eslint-config-prettier": "^8.3.0",
|
|
44
46
|
"eslint-plugin-import": "^2.25.3",
|
|
45
|
-
"eslint-plugin-jest": "^
|
|
47
|
+
"eslint-plugin-jest": "^26.0.0",
|
|
46
48
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
47
49
|
"eslint-plugin-lodash": "^7.3.0",
|
|
48
50
|
"eslint-plugin-prettier": "^4.0.0",
|
|
@@ -55,8 +57,8 @@
|
|
|
55
57
|
"prettier": ">= 2.2.1"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
+
"prettier": "2.7.1",
|
|
61
|
+
"eslint": "8.20.0"
|
|
60
62
|
},
|
|
61
63
|
"publishConfig": {
|
|
62
64
|
"access": "public"
|