Skip to content

Commit 52a8abf

Browse files
committed
fix: remove ESLint 6 specific codes
1 parent 09a974f commit 52a8abf

File tree

3 files changed

+5
-29
lines changed

3 files changed

+5
-29
lines changed

README.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Lint JS inside GitHub Actions workflow
99

1010
## Installation
1111

12-
You'll first need to install [ESLint](http://eslint.org) 6.7 or greater:
12+
You'll first need to install [ESLint](http://eslint.org) 8 or greater:
1313
```
1414
$ npm i eslint --save-dev
1515
$ yarn add -D eslint
@@ -31,11 +31,6 @@ Extending the `plugin:actions/recommended` config will enable the processor on a
3131
}
3232
```
3333

34-
With ESLint v7, you can run it as usual. If you're using ESLint v6, you'll need to pass [`--ext` option](https://eslint.org/docs/user-guide/command-line-interface#ext) to include YAML files:
35-
```
36-
$ eslint --ext js,yml,yaml .
37-
```
38-
3934
Currently, only literal blocks (`|`) are supported and it's recommended to use them:
4035
```yaml
4136
# .github/workflows/ci.yml
@@ -54,16 +49,9 @@ The autofixing (`--fix`) is supported, but it's still experimental and whitespac
5449
### Advanced Configuration
5550

5651
Dotfiles are ignored by ESLint by default. To lint files inside `.github`, you'll need to add `!.github` to
57-
`.eslintignore` file or `ignorePatterns` of your configuration file. In ESLint v6, all files having extensions
58-
specified by `--ext` option are included, so to exclude non-workflow YAML files, add `*.yml`, `*.yaml`, and
59-
`!/.github/workflows/*.{yml,yaml}`:
52+
`.eslintignore` file or `ignorePatterns` of your configuration file:
6053
```gitignore
6154
!/.github
62-
# only for ESLint v6:
63-
*.yml
64-
*.yaml
65-
!/.github/workflows/*.yml
66-
!/.github/workflows/*.yaml
6755
```
6856

6957
Then, add `actions` to the plugins section of your configuration file. You can omit the `eslint-plugin-` prefix:

src/configs/recommended.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,9 @@ import { Linter } from 'eslint';
22

33
import { PLUGIN_NAME, WORKFLOW_DIR, WORKFLOW_FILE } from '../util/constants';
44

5-
const ignorePatterns = [
6-
// ignore other YAML files
7-
...WORKFLOW_FILE,
8-
// include workflow files, ESLint 6 doesn't do this by default
9-
...WORKFLOW_FILE.map(f => `!/${WORKFLOW_DIR}/${f}`),
10-
];
11-
12-
// ESLint ignores dotfiles
13-
if (WORKFLOW_DIR.startsWith('.')) {
14-
ignorePatterns.unshift(`!/${WORKFLOW_DIR.split('/')[0]}`);
15-
}
16-
175
const recommended: Linter.Config = {
186
plugins: [PLUGIN_NAME],
19-
ignorePatterns,
7+
ignorePatterns: [`!/${WORKFLOW_DIR.split('/')[0]}`],
208
overrides: [{
219
files: WORKFLOW_FILE.map(f => `${WORKFLOW_DIR}/${f}`),
2210
processor: `${PLUGIN_NAME}/actions`,

test/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"private": true,
44
"scripts": {
55
"test": "cp test.eslintrc.js .eslintrc.js && yarn test:lint && yarn test:fix && rm .eslintrc.js",
6-
"test:lint": "yarn eslint --ext js,yml . | diff -I '^[/$iy].*' fixtures/result.txt -",
7-
"test:fix": "cp .github/workflows/test.yml test.yml.bak && yarn eslint --ext js,yml --fix . | diff -I '^[/$iy].*' fixtures/result-fixed.txt - && diff .github/workflows/test.yml .github/workflows-fixed/test.yml && cp test.yml.bak .github/workflows/test.yml"
6+
"test:lint": "yarn eslint . | diff -I '^[/$iy].*' fixtures/result.txt -",
7+
"test:fix": "cp .github/workflows/test.yml test.yml.bak && yarn eslint --fix . | diff -I '^[/$iy].*' fixtures/result-fixed.txt - && diff .github/workflows/test.yml .github/workflows-fixed/test.yml && cp test.yml.bak .github/workflows/test.yml"
88
},
99
"devDependencies": {
1010
"eslint-plugin-actions": "portal:../"

0 commit comments

Comments
 (0)