-
Notifications
You must be signed in to change notification settings - Fork 399
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
Fix ESLint setup #240
Fix ESLint setup #240
Conversation
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.
Hi @friederbluemle,
Thanks for the PR. The changes related to fixing ESLint look good and are welcome.
The unrelated changes I advise you to create a PR in the RN repo, so we can move it over as soon it's merged there.
template/_prettierrc.js
Outdated
bracketSpacing: false, | ||
jsxBracketSameLine: true, |
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 know that this has been deprecated, but since this template aims to be consistent with the default RN template, I advise you to create a PR for that in the RN repo: https://github.com/facebook/react-native/blob/v0.66.4/template/_prettierrc.js
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.
Makes sense! I only checked that main
branch in react-native
, which has this addressed already.
template/_prettierrc.js
Outdated
@@ -1,7 +1,7 @@ | |||
module.exports = { | |||
arrowParens: 'avoid', |
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.
Here also, please undo the re-sort, so it's consistent with the default RN template.
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.
Okay, I'll undo this, and we'll wait until this arrives in the next release of react-native
.
312805c
to
55f9da4
Compare
Hi @emin93 - Thanks for the super fast review. I agree with what you said and removed the commit that changes .prettierrc.js |
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.
Looks good, thanks for the updates 👍
Sorry about the no shadow issue! That was cherry picked from a config change I needed but didn't work in isolation I guess. Is there no CI here that runs these things?I could look into that if not |
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.
Didn't realize those deps for no shadow weren't here yet, bad testing on my part from last PR
@mikehardy Good idea with testing this in the CI. You are more than welcome to look into it. 👍 |
Summary: ESLint configuration is derived from `react-native/eslint-config`, which has supported Flow, vanilla JS, and TypeScript. react-native-community/react-native-template-typescript#238 and a related PR ended up adding new rules to the TypeScript config, to fix bugs with TS linting. It required a followup change, to specify the parser/plugin, and explicity reference them as devDependencies. react-native-community/react-native-template-typescript#240 `react-native/eslint-config` already includes setting the plugin/parser. But overriding rules requires declaring that again, and directly referencing a plugin means a need for the app to declare dependencies, since ESLint resolves modules from the current config. The rules overridedn were later fixed in `react-native/eslint-config`, which is really the right place for the fix (e.g. facebook#32644). I noticed this when deriving from the TS template in facebook#32644 and removed the rule overrides, but didn't have the historical context to realize this means we can then: 1. Remove the explicit parser/plugins since `react-native/eslint-config` already sets them, and we are no longer overriding any rules. 2. Remove the devDependencies, to let the versions be managed entirely by `react-native/eslint-config`. Changelog: [General][Changed] - Simplify Template ESLint Configuration Differential Revision: D41652699 fbshipit-source-id: 67620f12f8fa0ec94fc4db2cbbd2a60a62b70874
Summary: Pull Request resolved: #35529 ESLint configuration is derived from `react-native/eslint-config`, which has supported Flow, vanilla JS, and TypeScript. react-native-community/react-native-template-typescript#238 and a related PR ended up adding new rules to the TypeScript config, to fix bugs with TS linting. It required a followup change, to specify the parser/plugin, and explicity reference them as devDependencies. react-native-community/react-native-template-typescript#240 `react-native/eslint-config` already includes setting the plugin/parser. But overriding rules requires declaring that again, and directly referencing a plugin means a need for the app to declare dependencies, since ESLint resolves modules from the current config. The rules overridedn were later fixed in `react-native/eslint-config`, which is really the right place for the fix (e.g. #32644). I noticed this when deriving from the TS template in #32644 and removed the rule overrides, but didn't have the historical context to realize this means we can then: 1. Remove the explicit parser/plugins since `react-native/eslint-config` already sets them, and we are no longer overriding any rules. 2. Remove the devDependencies, to let the versions be managed entirely by `react-native/eslint-config`. Changelog: [General][Changed] - Simplify Template ESLint Configuration Reviewed By: cortinico Differential Revision: D41652699 fbshipit-source-id: 8e3313dbf27407c5866f3c2432cffc2ecec1b01d
Summary: Pull Request resolved: #35529 ESLint configuration is derived from `react-native/eslint-config`, which has supported Flow, vanilla JS, and TypeScript. react-native-community/react-native-template-typescript#238 and a related PR ended up adding new rules to the TypeScript config, to fix bugs with TS linting. It required a followup change, to specify the parser/plugin, and explicity reference them as devDependencies. react-native-community/react-native-template-typescript#240 `react-native/eslint-config` already includes setting the plugin/parser. But overriding rules requires declaring that again, and directly referencing a plugin means a need for the app to declare dependencies, since ESLint resolves modules from the current config. The rules overridedn were later fixed in `react-native/eslint-config`, which is really the right place for the fix (e.g. #32644). I noticed this when deriving from the TS template in #32644 and removed the rule overrides, but didn't have the historical context to realize this means we can then: 1. Remove the explicit parser/plugins since `react-native/eslint-config` already sets them, and we are no longer overriding any rules. 2. Remove the devDependencies, to let the versions be managed entirely by `react-native/eslint-config`. Changelog: [General][Changed] - Simplify Template ESLint Configuration Reviewed By: cortinico Differential Revision: D41652699 fbshipit-source-id: 8e3313dbf27407c5866f3c2432cffc2ecec1b01d # Conflicts: # template/_eslintrc.js
Summary: Pull Request resolved: facebook#35529 ESLint configuration is derived from `react-native/eslint-config`, which has supported Flow, vanilla JS, and TypeScript. react-native-community/react-native-template-typescript#238 and a related PR ended up adding new rules to the TypeScript config, to fix bugs with TS linting. It required a followup change, to specify the parser/plugin, and explicity reference them as devDependencies. react-native-community/react-native-template-typescript#240 `react-native/eslint-config` already includes setting the plugin/parser. But overriding rules requires declaring that again, and directly referencing a plugin means a need for the app to declare dependencies, since ESLint resolves modules from the current config. The rules overridedn were later fixed in `react-native/eslint-config`, which is really the right place for the fix (e.g. facebook#32644). I noticed this when deriving from the TS template in facebook#32644 and removed the rule overrides, but didn't have the historical context to realize this means we can then: 1. Remove the explicit parser/plugins since `react-native/eslint-config` already sets them, and we are no longer overriding any rules. 2. Remove the devDependencies, to let the versions be managed entirely by `react-native/eslint-config`. Changelog: [General][Changed] - Simplify Template ESLint Configuration Reviewed By: cortinico Differential Revision: D41652699 fbshipit-source-id: 8e3313dbf27407c5866f3c2432cffc2ecec1b01d
There are several issues related to the current ESLint/TypeScript setup with the latest version of this template.
Steps to reproduce:
npx react-native init rntsapp --template react-native-template-typescript
yarn lint
and
Also,
.eslintrc.js
contained a few quote warnings/errors that were also fixed.Related: #112 #150 #238
Fixes #237