1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-10 12:35:46 +03:00

refactor(ci): Lint PR diffs only (#4137)

*  Set up `eslint-plugin-diff`

* 🔧 Fix setup

* ⬆️ Upgrade `checkout` and `setup-node`

* 🔧 Fix YAML

* 🧪 Verify `eslint-plugin-diff` behavior

* Revert "🧪 Verify `eslint-plugin-diff` behavior"

This reverts commit 1fcc6c8299.

* ✏️ Fix comment
This commit is contained in:
Iván Ovejero 2022-09-21 10:24:39 +02:00 committed by GitHub
parent 97cd564f7b
commit a2441b8e3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 13 deletions

View File

@ -13,18 +13,27 @@ jobs:
node-version: [14.x, 16.x]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: npm install, build, and test
run: |
npm install -g npm@latest
npm install
npm run build --if-present
npm test
npm run lint
- name: Install npm and dependencies
run: npm install -g npm@latest && npm install
- name: Build
run: npm run build --if-present
- name: Test
run: npm run test
- name: Fetch base branch for `git diff`
run: git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
- name: Run ESLint on changes only
env:
CI: true
ESLINT_PLUGIN_DIFF_COMMIT: ${{ github.event.pull_request.base.ref }}
run: npm run lint

20
package-lock.json generated
View File

@ -21790,6 +21790,18 @@
"ms": "^2.1.1"
}
},
"node_modules/eslint-plugin-diff": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-diff/-/eslint-plugin-diff-2.0.1.tgz",
"integrity": "sha512-qqbvwaaO1cfkUprliqiRojRsD0qGsvzmJNqNrb9s0h15sDVzZMXYdu0TUFpUwauLeU28etSsfWIp0Uu+OAcXXw==",
"dev": true,
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"eslint": ">=6.7.0"
}
},
"node_modules/eslint-plugin-import": {
"version": "2.26.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz",
@ -52138,6 +52150,7 @@
"eslint": "8.23.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-diff": "^2.0.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.4.0"
@ -55958,6 +55971,7 @@
"eslint": "8.23.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-diff": "^2.0.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.4.0"
@ -70014,6 +70028,12 @@
}
}
},
"eslint-plugin-diff": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-diff/-/eslint-plugin-diff-2.0.1.tgz",
"integrity": "sha512-qqbvwaaO1cfkUprliqiRojRsD0qGsvzmJNqNrb9s0h15sDVzZMXYdu0TUFpUwauLeU28etSsfWIp0Uu+OAcXXw==",
"dev": true
},
"eslint-plugin-import": {
"version": "2.26.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz",

View File

@ -33,6 +33,13 @@ module.exports = {
* https://github.com/prettier/eslint-plugin-prettier
*/
'eslint-plugin-prettier',
/**
* Plugin to lint only changes
*
* https://github.com/paleite/eslint-plugin-diff#plugindiffdiff-recommended
*/
'eslint-plugin-diff',
],
extends: [
@ -64,6 +71,13 @@ module.exports = {
* https://github.com/prettier/eslint-config-prettier
*/
'eslint-config-prettier',
/**
* Config for eslint-plugin-diff
*
* https://github.com/paleite/eslint-plugin-diff#plugindiffdiff-recommended
*/
'plugin:diff/diff',
],
rules: {
@ -180,10 +194,7 @@ module.exports = {
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
*/
'@typescript-eslint/explicit-member-accessibility': [
'error',
{ accessibility: 'no-public' },
],
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md

View File

@ -9,6 +9,7 @@
"eslint": "8.23.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-diff": "^2.0.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.4.0"