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

[chore] Fix eslint so it uses a common config for packages #1886

Merged
merged 5 commits into from
Jun 8, 2020

Conversation

mariuslundgard
Copy link
Member

@mariuslundgard mariuslundgard commented May 18, 2020

  • Resolves the issue of eslint config for TS files "bleeding" over into JS files.
  • Configures the monorepo to use a common .eslintrc.js for all packages, no matter if they include JS or TS or both (no need to add a .eslintrc in the packages that extends the root config).
  • Installs and configures eslint-plugin-react-hooks.

@vercel
Copy link

vercel bot commented May 18, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sanity-io/test-studio/oi9594739
✅ Preview: https://test-studio-git-chore-fix-eslint.sanity-io.now.sh

@vercel vercel bot temporarily deployed to Preview May 18, 2020 22:35 Inactive
@vercel vercel bot temporarily deployed to Preview May 18, 2020 22:40 Inactive
@vercel vercel bot temporarily deployed to Preview May 18, 2020 22:45 Inactive
@vercel vercel bot temporarily deployed to Preview May 18, 2020 22:50 Inactive
@vercel vercel bot temporarily deployed to Preview May 18, 2020 22:54 Inactive
.eslintrc.js Outdated Show resolved Hide resolved
@mariuslundgard
Copy link
Member Author

mariuslundgard commented Jun 8, 2020

Update: did some changes because the import plugin seemed to still get loaded for TS files, even though it was overridden. (So it seems the "overrides" items don't replace, but extend the common configuration.)

@vercel vercel bot temporarily deployed to Preview June 8, 2020 09:42 Inactive
@vercel vercel bot temporarily deployed to Preview June 8, 2020 09:43 Inactive
… all)

- Use a single configuration for all source files (typescript/javascript)
- Use the @typescript/eslint-parser for everything
- Using sanity-eslint to typescript config too
- Disable the '@typescript/no-use-before-define' rule
- Disable the 'react/no-multi-comp' rule
- Disable the 'react/require-optimization' rule
- Disable the 'import/prefer-default-export' rule
- Disabling 'import/no-commonjs' in favor of '@typescript-eslint/no-var-requires'
- Allow commonjs in certain packages by disabling '@typescript-eslint/no-var-requires'
@mariuslundgard mariuslundgard merged commit a62ad95 into next Jun 8, 2020
@mariuslundgard mariuslundgard deleted the chore-fix-eslint branch June 8, 2020 18:59
bjoerge added a commit that referenced this pull request Jun 8, 2020
* [chore] Fix eslint so it uses a common config for packages

* [chore] Add JS extensions to lint command

* [chore] Move eslint extends config in order to apply correct order of rules

* [chore] Postpone introduction of eslint-plugin-react-hooks

* [chore] Simplify proposed eslint setup a bit (one config to rule them all)

- Use a single configuration for all source files (typescript/javascript)
- Use the @typescript/eslint-parser for everything
- Using sanity-eslint to typescript config too
- Disable the '@typescript/no-use-before-define' rule
- Disable the 'react/no-multi-comp' rule
- Disable the 'react/require-optimization' rule
- Disable the 'import/prefer-default-export' rule
- Disabling 'import/no-commonjs' in favor of '@typescript-eslint/no-var-requires'
- Allow commonjs in certain packages by disabling '@typescript-eslint/no-var-requires'

Co-authored-by: Bjørge Næss <bjoerge@gmail.com>
mariuslundgard added a commit that referenced this pull request Jun 9, 2020
* [chore] Fix eslint so it uses a common config for packages

* [chore] Add JS extensions to lint command

* [chore] Move eslint extends config in order to apply correct order of rules

* [chore] Postpone introduction of eslint-plugin-react-hooks

* [chore] Simplify proposed eslint setup a bit (one config to rule them all)

- Use a single configuration for all source files (typescript/javascript)
- Use the @typescript/eslint-parser for everything
- Using sanity-eslint to typescript config too
- Disable the '@typescript/no-use-before-define' rule
- Disable the 'react/no-multi-comp' rule
- Disable the 'react/require-optimization' rule
- Disable the 'import/prefer-default-export' rule
- Disabling 'import/no-commonjs' in favor of '@typescript-eslint/no-var-requires'
- Allow commonjs in certain packages by disabling '@typescript-eslint/no-var-requires'

Co-authored-by: Bjørge Næss <bjoerge@gmail.com>
rexxars pushed a commit that referenced this pull request Jan 26, 2022
* [chore] Fix eslint so it uses a common config for packages

* [chore] Add JS extensions to lint command

* [chore] Move eslint extends config in order to apply correct order of rules

* [chore] Postpone introduction of eslint-plugin-react-hooks

* [chore] Simplify proposed eslint setup a bit (one config to rule them all)

- Use a single configuration for all source files (typescript/javascript)
- Use the @typescript/eslint-parser for everything
- Using sanity-eslint to typescript config too
- Disable the '@typescript/no-use-before-define' rule
- Disable the 'react/no-multi-comp' rule
- Disable the 'react/require-optimization' rule
- Disable the 'import/prefer-default-export' rule
- Disabling 'import/no-commonjs' in favor of '@typescript-eslint/no-var-requires'
- Allow commonjs in certain packages by disabling '@typescript-eslint/no-var-requires'

Co-authored-by: Bjørge Næss <bjoerge@gmail.com>
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.

None yet

3 participants