Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint does not use custom directories from next.config.js #26393

Closed
michalbundyra opened this issue Jun 20, 2021 · 4 comments · Fixed by #26401
Closed

ESLint does not use custom directories from next.config.js #26393

michalbundyra opened this issue Jun 20, 2021 · 4 comments · Fixed by #26401
Labels
bug Issue was opened via the bug report template.

Comments

@michalbundyra
Copy link
Contributor

What version of Next.js are you using?

11.0.0

What version of Node.js are you using?

16.1.0

What browser are you using?

not important

What operating system are you using?

macOS

How are you deploying your application?

not important

Describe the Bug

Custom directories for linting are not used when running next lint, but only when running next build

We are missing eslint.dirs somewhere:

const dirs: string[] = args['--dir']
const lintDirs = (dirs ?? ESLINT_DEFAULT_DIRS).reduce(
(res: string[], d: string) => {
const currDir = join(baseDir, d)
if (!existsSync(currDir)) return res
res.push(currDir)
return res
},
[]
)

as we have it here:

const lintDirs = config.eslint?.dirs

Related to: #25895

Expected Behavior

Custom directories for linting are used also on next lint run.

To Reproduce

Create project and configure any custom directory in next.config.js, put there any file with some obvious issues and try to run linter.

It's not going to fail with next lint, but only with next build.

@michalbundyra michalbundyra added the bug Issue was opened via the bug report template. label Jun 20, 2021
michalbundyra added a commit to michalbundyra/next.js that referenced this issue Jun 20, 2021
Attempt to fix vercel#26393

Sorry, I wasn't able to run tests on local, but I hope at least unit test
should be valid.
michalbundyra added a commit to michalbundyra/next.js that referenced this issue Jun 20, 2021
Attempt to fix vercel#26393

Sorry, I wasn't able to run tests on local, but I hope at least test
should be valid.
@nghiepdev
Copy link
Contributor

Same issue, but the document Linting Custom Directories describes only for production builds

@michalbundyra
Copy link
Contributor Author

@nghiepit

only for production builds

thanks for pointing this out, I have completely missed that, and it has no sense for me, use custom directories only for production build. This is how I noted the issue. Hopefully it will be accepted and fixed.

michalbundyra added a commit to michalbundyra/next.js that referenced this issue Jun 21, 2021
Attempt to fix vercel#26393

Sorry, I wasn't able to run tests on local, but I hope at least test
should be valid.
@Flowkap
Copy link

Flowkap commented Jul 13, 2021

Same here. Any workaround to not use next build to discover the linting issues?

@kodiakhq kodiakhq bot closed this as completed in #26401 Jul 25, 2021
kodiakhq bot pushed a commit that referenced this issue Jul 25, 2021
Attempt to fix #26393

~~Sorry, I wasn't able to run tests on local, but I hope at least test should be valid.~~
Edit: Tests are working correctly on my local :) 

fixes #26393



## Bug

- [x] Related issues linked using `fixes #26393`
- [x] Integration tests added
flybayer pushed a commit to blitz-js/next.js that referenced this issue Aug 19, 2021
Attempt to fix vercel#26393

~~Sorry, I wasn't able to run tests on local, but I hope at least test should be valid.~~
Edit: Tests are working correctly on my local :) 

fixes vercel#26393



## Bug

- [x] Related issues linked using `fixes vercel#26393`
- [x] Integration tests added
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants