eslint-suggestion-action
eslint-suggestion-action copied to clipboard
Always ESLint passes
trafficstars
Hi, can you tell me what I'm doing wrong? Here is the file.github/workflows/eslint.yml -
name: ESLint
permissions: write-all
on:
pull_request:
branches: [main]
jobs:
build:
runs-on: self-hosted
container:
image: node:lts-alpine3.19
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
cd ./app
yarn install
- uses: CatChen/eslint-suggestion-action@v2
with:
request-changes: true # optional
directory: './app' #optional
targets: './{pages,components,composables,consts,layouts}/**/*.*' #optional
eslint-lib-path: './node_modules/eslint/lib/api.js' #optional
eslint-bin-path: './node_modules/.bin/eslint' # optional
Project structure -
.
├── .github
│ └── workflows
└── app
├── .env
├── .eslintrc.cjs
├── .gitignore
├── .nuxt
├── .prettierrc
├── README.md
├── app.vue
├── assets
├── components
├── composables
├── consts
├── layouts
├── node_modules
├── nuxt.config.ts
├── package.json
├── pages
├── public
├── server
├── tsconfig.json
└── yarn.lock
I purposely left errors in the code to check the work, but I always get a Notice: ESLint passes
Here are the rules that I have set (.eslintrc.cjs)
module.exports = {
'env': {
'browser': true,
'es2021': true,
'node': true
},
'extends': [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-essential',
'prettier'
],
'overrides': [
{
'env': {
'node': true
},
'files': [
'.eslintrc.{js,cjs}'
],
'parserOptions': {
'sourceType': 'script'
}
}
],
'parserOptions': {
'ecmaVersion': 'latest',
'parser': '@typescript-eslint/parser',
'sourceType': 'module'
},
'plugins': [
'@typescript-eslint',
'vue'
],
'rules': {
'vue/multi-word-component-names': 'off',
'indent': [
'error',
'tab'
],
'vue/max-attributes-per-line': ['error', {
'singleline': {
'max': 1
},
'multiline': {
'max': 1
}
}],
'linebreak-style': [
'error',
'unix'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
]
}
};
If I run the linter locally, it will give me the following -
/Users/ostiwe/.nvm/versions/node/v21.0.0/bin/npm run lint
> lint
> eslint ./{pages,components,composables,consts,layouts}/**/*.*
<path-to-project>/app/components/client/components/Icons/ChevronUp.vue
6:18 error 'height' should be on a new line vue/max-attributes-per-line
6:30 error 'viewBox' should be on a new line vue/max-attributes-per-line
6:50 error 'fill' should be on a new line vue/max-attributes-per-line
6:62 error 'xmlns' should be on a new line vue/max-attributes-per-line
7:30 error 'stroke' should be on a new line vue/max-attributes-per-line
7:47 error 'stroke-width' should be on a new line vue/max-attributes-per-line
7:64 error 'stroke-linecap' should be on a new line vue/max-attributes-per-line
7:87 error 'stroke-linejoin' should be on a new line vue/max-attributes-per-line
<path-to-project>/app/components/client/components/Input/index.scss
1:0 error Parsing error: Declaration or statement expected
<path-to-project>/app/components/client/components/NewsItem/index.vue
3:32 error 'v-if' should be on a new line vue/max-attributes-per-line
I will be glad if they can help me here
@Ostiwe I think the issue is CatChen/eslint-suggestion-action@v2 assumes the config file name: .eslintrc.json. Please upgrade to CatChen/eslint-suggestion-action@v4 and use the config-path to set your config file (you mentioned .eslintrc.cjs). Let me know if that helps. Thanks!