Skip to content

Commit 2b362c4

Browse files
committed
Improve Github Actions
1 parent ad98388 commit 2b362c4

File tree

5 files changed

+83
-70
lines changed

5 files changed

+83
-70
lines changed

.github/workflows/check.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Check
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
9+
jobs:
10+
main:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [15.x]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- uses: actions/setup-node@v1
21+
with:
22+
node-version: "${{ matrix.node-version }}"
23+
24+
- name: Cache node_modules
25+
id: cache-node_modules
26+
uses: actions/cache@v2
27+
with:
28+
path: node_modules
29+
key: node_modules-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
30+
31+
- name: npm ci
32+
if: steps.cache-node_modules.outputs.cache-hit != 'true'
33+
run: npm ci
34+
35+
- name: Build
36+
run: npm run build
37+
38+
- name: ESLint
39+
run: npx --no-install eslint . --report-unused-disable-directives
40+
41+
- name: Prettier
42+
run: npx --no-install prettier --check .

.github/workflows/ci.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
9+
jobs:
10+
main:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [10.x, 12.x, 14.x, 15.x]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- uses: actions/setup-node@v1
21+
with:
22+
node-version: "${{ matrix.node-version }}"
23+
24+
- name: Cache node_modules
25+
id: cache-node_modules
26+
uses: actions/cache@v2
27+
with:
28+
path: node_modules
29+
key: node_modules-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
30+
31+
- name: npm ci
32+
if: steps.cache-node_modules.outputs.cache-hit != 'true'
33+
run: npm ci
34+
35+
- name: Jest
36+
run: npx --no-install jest --coverage

README.md

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ This is for those who use `eslint --fix` (autofix) a lot and want to completely
4141
- [The sorting autofix causes some odd whitespace!](#the-sorting-autofix-causes-some-odd-whitespace)
4242
- [Can I use this without autofix?](#can-i-use-this-without-autofix)
4343
- [How do I use eslint-ignore for this rule?](#how-do-i-use-eslint-ignore-for-this-rule)
44-
- [Development](#development)
45-
- [npm scripts](#npm-scripts)
46-
- [Directories](#directories)
4744
- [License](#license)
4845

4946
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -536,33 +533,12 @@ Not really. The error message for this rule is literally “Run autofix to sort
536533

537534
Looking for `/* eslint-disable */` for this rule? Read all about **[ignoring (parts of) sorting][example-ignore].**
538535

539-
## Development
540-
541-
You need [Node.js] ~12 and npm 6.
542-
543-
### npm scripts
544-
545-
- `npx jest --watch`: Run [Jest] tests in watch mode.
546-
- `npm run doctoc`: Run [doctoc] on README.md.
547-
- `npm run prettier`: Autoformat files with [Prettier].
548-
- `npm run eslint`: Autofix [ESLint] errors.
549-
- `npm run eslint:examples`: Used by `test/examples.test.js`.
550-
- `npm test`: Check that everything works.
551-
- `npm publish`: Publish to [npm], but only if `npm test` passes.
552-
553-
### Directories
554-
555-
- `src/`: Source code.
556-
- `examples/`: Examples, tested in `test/examples.test.js`.
557-
- `test/`: [Jest] tests.
558-
559536
## License
560537

561538
[MIT](LICENSE)
562539

563540
[comment-handling]: #comment-and-whitespace-handling
564541
[custom grouping]: #custom-grouping
565-
[doctoc]: https://github.com/thlorenz/doctoc/
566542
[eslint-fix]: https://eslint.org/docs/user-guide/command-line-interface#--fix
567543
[eslint]: https://eslint.org/
568544
[example-ignore]: https://github.com/lydell/eslint-plugin-simple-import-sort/blob/master/examples/ignore.js
@@ -575,10 +551,7 @@ You need [Node.js] ~12 and npm 6.
575551
[import/order]: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
576552
[intl.collator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator
577553
[issue #31]: https://github.com/lydell/eslint-plugin-simple-import-sort/issues/31
578-
[jest]: https://jestjs.io/
579554
[lines-around-comment]: https://eslint.org/docs/rules/lines-around-comment
580-
[node.js]: https://nodejs.org/en/
581-
[npm]: https://www.npmjs.com/
582555
[odd-whitespace]: #the-sorting-autofix-causes-some-odd-whitespace
583556
[padding-line-between-statements]: https://eslint.org/docs/rules/padding-line-between-statements
584557
[sort order]: #sort-order

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"type": "commonjs",
44
"scripts": {
55
"doctoc": "doctoc README.md",
6-
"prettier": "prettier --write .",
7-
"eslint": "eslint . --fix",
8-
"eslint:examples": "eslint --rulesdir src --no-ignore --fix-dry-run --format json --report-unused-disable-directives examples --ext .js,.ts,.vue,.md",
9-
"test": "prettier --check . && eslint . --report-unused-disable-directives && node build.js && jest --coverage"
6+
"pretest": "prettier --check . && eslint . --report-unused-disable-directives",
7+
"test": "jest --coverage",
8+
"posttest": "npm run build",
9+
"build": "node build.js",
10+
"eslint:examples": "eslint --rulesdir src --no-ignore --fix-dry-run --format json --report-unused-disable-directives examples --ext .js,.ts,.vue,.md"
1011
},
1112
"devDependencies": {
1213
"@typescript-eslint/parser": "4.6.1",

0 commit comments

Comments
 (0)