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

feat: disable prettier conflicts, change lint-staged to just lint-all #119

Merged
merged 10 commits into from
Jan 25, 2022

Conversation

reginawang3495
Copy link
Contributor

@reginawang3495 reginawang3495 commented Jan 23, 2022

Summary

  • Remove prettier rules from eslint and stylelint since there are prettier and eslint/stylelint conflicts
  • Removed lint-staged and replace with simple lint-fix on all files
  • Added prettier to yarn lint

closes #113
closes #114

Test Plan

  • made a change that should fail linting
  • check to see that it fails
  • check to see that it is automatically fixed with yarn lint-fix

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>
Signed-off-by: Regina Wang <rrreggginnna@gmail.com>
@netlify
Copy link

netlify bot commented Jan 23, 2022

✔️ Deploy Preview for teach-la-ts-react-starter ready!

🔨 Explore the source changes: e11e7a3

🔍 Inspect the deploy log: https://app.netlify.com/sites/teach-la-ts-react-starter/deploys/61f0782b7b655500071921a0

😎 Browse the preview: https://deploy-preview-119--teach-la-ts-react-starter.netlify.app

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>
@reginawang3495 reginawang3495 changed the title feat: Improve linting, remove lint-staged to just lint-all feat: remove prettier, remove lint-staged to just lint-all Jan 23, 2022
@reginawang3495 reginawang3495 changed the title feat: remove prettier, remove lint-staged to just lint-all feat: disable prettier conflicts, change lint-staged to just lint-all Jan 23, 2022
Signed-off-by: Regina Wang <rrreggginnna@gmail.com>
Copy link
Contributor

@doubleiis02 doubleiis02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oki i read through this all, seems like half the changes are just changes made by prettier itself, and the other half is code that implements prettier + its settings and then gets rid of stuff that prettier takes care of. i think it looks good

Copy link
Member

@matthewcn56 matthewcn56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea of changing lint-staged to just fix all the linting progress overall as it would streamline the development process of fixing small errors on its own! However, I think in its current state, some es-lint and prettier rules are clashing, and could be solved with the es-lint prettier plugin as specified here and as specified in the review comment.

.eslintrc.js Outdated
// ensures clean diffs, see https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8
'comma-dangle': ['error', 'always-multiline'],
// Covered by prettier
'comma-dangle': 'off',
Copy link
Member

@matthewcn56 matthewcn56 Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically adding in the 'comma-dangle': off clashes with prettier when linting and does not enforce that dangling commas should be there.

When using eslint with prettier, I think it would be better to add in the prettier plugin to our .eslintrc.js as specified here, and adding it at the end of our array of plugins.

And for things that are already covered by prettier like comma-dangle, instead of specifying off, we can just not mention the comma-dangle property at all, as comma-dangle off doesn't enforce dangling commas when linting within our pre-commit hook or yarn lint-fix command, but commenting it out does enforce it (when used in conjunction with the prettier es-lint plugin).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk sounds good, ty for the review!

Copy link
Contributor

@timothycpoon timothycpoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a +1 to Matt’s comment. Some of the linting decisions were made w/ the editor’s situation In mind so it makes sense that some should be changed

package.json Outdated Show resolved Hide resolved
Signed-off-by: Regina Wang <rrreggginnna@gmail.com>
Signed-off-by: Regina Wang <rrreggginnna@gmail.com>
Signed-off-by: Regina Wang <rrreggginnna@gmail.com>
@matthewcn56
Copy link
Member

nice, looks like they don't conflict anymore!

@matthewcn56 matthewcn56 self-requested a review January 25, 2022 22:24
@reginawang3495 reginawang3495 merged commit 75c60e4 into main Jan 25, 2022
@reginawang3495 reginawang3495 deleted the improve_linting branch January 25, 2022 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature Request: Improve linting 🐾 Minor Update: husky lint staged --> lint fix
4 participants