Comments (14)
What settings are you using? This is the purpose of the errorOnUnmatchedPattern
which should default to false.
from eslint-plus-action.
I agree that errorOnUnmatchedPattern
defaulted to false should work.. the only setting we've toggled is reportWarnings
🤔
the following is our exact setup:
name: 'eslint'
on: [pull_request]
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/[email protected]
with:
reportWarnings: false
from eslint-plus-action.
@bradennapier are you able to take a look? this issue is coming up quite often for us during things like refactoring. the only workaround to remove the failing check is to manually delete the Workflow results
I was originally going to suggest filtering the files fetched from the PR by checking file.status === 'deleted'
, but I don't think that is being return from the GraphQL request that is being made
from eslint-plus-action.
@bradennapier are you able to take a look? this issue is coming up quite often for us during things like refactoring. the only workaround to remove the failing check is to manually delete the Workflow results
I was originally going to suggest filtering the files fetched from the PR by checking
file.status === 'deleted'
, but I don't think that is being return from the GraphQL request that is being made
I was planning to look into this ASAP - that was my expected solution :-P
from eslint-plus-action.
@imsteev see the PR #31 - mine works fine when I deleted src/quick.ts
What does the eslintconfig
for your project look like? Are you potentially enabling the errorOnUnmatched
there?
Also - what version of eslint are you using? Looks like the errorOnUmatchedPattern
was added in 6.8.0
from eslint-plus-action.
@bradennapier our config file looks like:
module.exports = {
extends: [
'react-app',
'prettier',
'plugin:@typescript-eslint/recommended'
],
plugins: ['react-hooks', 'mocha', 'i18next', '@typescript-eslint'],
ignorePatterns: ['build/**'],
rules: {
...
},
overrides: [
{
files: ['*.test.ts', '*.test.tsx', '*.spec.ts'],
rules: {
...
}
}
]
};
and the debug output before running ESLint:
[ESLINT] Run With Configuration {
extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
ignore: true,
useEslintrc: true,
rulePaths: [],
errorOnUnmatchedPattern: false,
fix: false,
configFile: undefined
}
from eslint-plus-action.
Also - what version of eslint are you using? Looks like the errorOnUmatchedPattern was added in 6.8.0
oh wait this might be it... we're on 6.7.2
from eslint-plus-action.
@bradennapier alright bumping the version of ESLint to latest works for me (meaning the workflow passed with a deleted file!)
the downside to this is that I have to add SKIP_PREFLIGHT_CHECK=true
to ignore CRA's dependency check before a yarn start.
from eslint-plus-action.
Ah yeah - quick google shows thats a pretty big overall annoyance people have ... not much can be done there there :-\ I could do a force yarn add
on eslint after you checkout but that prob would have unwanted side effects :-)
from eslint-plus-action.
You could add a command in the workflow right before the linting runs that updates eslint though, assuming that wouldn't cause any unwanted changes. It doesn't look like anything breaking between the two versions.
I edited that in the issue so the indenting is probably wrong FYI
name: "lint"
on: [pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update eslint
run: yarn add --dev [email protected]
- uses: bradennapier/[email protected]
with:
reportWarnings: false
from eslint-plus-action.
yeah any time i have to change a react-scripts dependencies, that SKIP_PREFLIGHT_CHECK
flag is necessary. the workflow edit you mentioned seems promising, i didn't know you could add intermediate steps
from eslint-plus-action.
Yep, you would actually want to do more than that, we skip installing your dependencies if we find node_modules
exists when the action is called so you can also use that to cache your modules. If that would cause errors with CRA you can add the SKIP_PREFLIGHT_CHECK
flag to your env for any of the steps with an env
property on any given step as well.
name: "lint"
on:
# by adding a schedule task to this workflow we will automatically
# begin serializing read-only runs and handling them. The cron job
# below is set to run every 15 minutes, GitHub will ignore anything
# under 10 minutes and run every 10 minutes anyway.
schedule:
- cron: '*/15 * * * *'
pull_request:
types:
- opened
- synchronize
- closed
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --prefer-offline && yarn add --dev [email protected]
env:
NODE_ENV: development
- uses: bradennapier/[email protected]
with:
reportWarnings: false
Haven't tested that lol but it should work - i dont know if caching would get confused by the fact the lock file would be adjusted there... but i think it should be fine because it would actually cache after the lock is updated --
from eslint-plus-action.
@bradennapier thanks for this info. I think I have a solution that works, but it jumps through a lot of hoops just to get this Workflow to run.
I wonder if a long-term solution that supports backwards compatibility is to just filter out all the files in the PR/diff that are deleted, and not pass them to ESLint at all. Otherwise I think it'd be helpful to document that this action requires 6.8.0 and above for errorOnUnmatchedPattern
from eslint-plus-action.
Yeah, the problem is that isn't very easy to do since we don't get that meta from graphql
-- there was an important reason for the original dev using the graphql instead of the rest request but I can't remember what it was. Kind of sucks you can't get that information from it though.
Happy to consider other options -- iterating all the changed files and checking if they exist doesn't seem ideal.
from eslint-plus-action.
Related Issues (17)
- Annotation limit is failing PRs HOT 3
- annotateWarnings doesn't work HOT 4
- Workflow fails for forked PRs HOT 3
- The automated release is failing 🚨
- Failed to generate URL to download artifact HOT 8
- Action using deprecated CLIEngine HOT 2
- Question: prettier support HOT 1
- Workflow appears twice HOT 2
- Failed to Run on Artifact: object is not iterable HOT 1
- Error: Cannot find module 'eslint' HOT 3
- no such file or directory, open '/github/workspace/package.json'
- All builds started failing with 'Failed to generate URL to download artifact' error HOT 2
- Action failing without error code
- A better approach for PRs from forks (workflow commands via stdout) HOT 1
- Remote PR Currently Fails HOT 10
- `TypeError: eslint_1.CLIEngine is not a constructor` in Node 16.11.1 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plus-action.