-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
lint: ignore js file #4431
lint: ignore js file #4431
Conversation
examples/todo/index.js
Outdated
@@ -12,6 +12,7 @@ if (require.main === module) { | |||
const config = { | |||
rest: { | |||
port: +process.env.PORT || 3000, | |||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ts eslint rules like @typescript-eslint/prefer-nullish-coalescing
shouldn't check js file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required for the build to pass? We already have this override - https://github.com/strongloop/loopback-next/blob/master/packages/eslint-config/eslintrc.js#L158
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raymondfeng Not really, our code base is good, and adding this line results in lint error...
But the todo example created by lb4 example
complains:
lb4 example (choose todo)
cd loopback4-example-todo
npm i
npm run lint
> @loopback/example-todo@1.9.4 lint /Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo
> npm run prettier:check && npm run eslint
> @loopback/example-todo@1.9.4 prettier:check /Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo
> npm run prettier:cli -- -l
> @loopback/example-todo@1.9.4 prettier:cli /Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo
> lb-prettier "**/*.ts" "-l"
> @loopback/example-todo@1.9.4 eslint /Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo
> lb-eslint --report-unused-disable-directives .
/Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo/index.js
15:30 error Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator @typescript-eslint/prefer-nullish-coalescing
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I wonder why https://github.com/strongloop/loopback-next/blob/master/packages/eslint-config/eslintrc.js#L158 does not exclude js files. Can you check which version of @loopback/eslint-config
is pulled in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raymondfeng It's already on the latest released version @loopback/eslint-config@5.0.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raymondfeng 👍 tested the config file, I think the necessary config is extends: ['@loopback/eslint-config']
Details verified in comment #4431 (comment)
a460bd5
to
f0ef5fc
Compare
f0ef5fc
to
1a17242
Compare
Verified with the latest cloned todo example: before adding the .eslintrc.js file
jannyHous-MacBook-Pro:loopback4-example-todo jannyhou$ npm run clean
after adding the .eslintrc.js file
|
1a17242
to
34ea4f1
Compare
34ea4f1
to
4852884
Compare
Fixes #4205
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈