-
Notifications
You must be signed in to change notification settings - Fork 1
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
4.0 eslint-config-norton fixes/tweaks #39
Conversation
…r extended configs
…fig disables them The style guide explicitly says that semicolons should be used: - https://wwnorton.github.io/style/docs/javascript#use-semicolons - https://wwnorton.github.io/style/docs/javascript#semicolons
- separate pure typescript rules from typescript+react rules - remove parserOptions from the config (this has to be set by the project) - add import/resolver settings for node & webpack
This is already included by extending eslint-config-airbnb/hooks.
this could potentiatlly break projects that are using the config but aren't using browser globals. it should be set in the project's eslintrc.
- jsx-filename-extension is already set to .jsx by eslint-config-airbnb (.tsx should be added by the typescript override) - jsx-props-no-spreading is part of airbnb and should only be disabled on a case-by-case basis - static-property-placement must be the default since 'static public field' isn't supported by most compilers (it's turned on in the typescript config) - the two react-hooks rules are set by extending `eslint-config-airbnb/hooks`
this allows us to remove the esm dev dependency
This is great! thanks for looking into the Eslint more Evan. Prettier
React
Typescript
Tests
|
I've faced an issue regarding the eslint-config-norton When using @typescript-eslint as a plugin in the overrides file I get a:
upon running the This presents an interesting problem. Overrides were implemented to be flexible where they only effect file extensions that are expected. However they still track their imports and dependencies and since this overrides file uses |
As I understand it, there are really two options for prettier:
|
This is a great point. I can think of two reasons why including
With that in mind, I would propose switching fully to an "entrypoint" approach along with listing The entrypoint approach is how nearly every major ESLint config works and I'm reluctant to reinvent the wheel for our config. For instance:
|
Hmm interesting point. However I feel like we can just adjust the options in Prettier to match our style guides. This is what was originally intended and implemented. The comma-dangle discrepancy was definitely missed at the time and possibly more. Are there any examples as to how ESLint is better at formatting js/ts than Prettier? If we use Prettier, for me, I think it'd be easier to stick to one way of formatting using Prettier across as many languages as we can. Leads to less gotchas? Which is why I am shying away from the second option. Unless ESLint has a strong "betterness" than Prettier in regards to js and ts. |
Typescript entrypoints
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
After installing
eslint-config-norton@4.0.0-beta.2
in a couple projects, I noticed that semicolons were no longer being enforced because of the use use ofeslint-config-prettier
. I ended up digging into the4.0
config a bit more and found some other issues that I've fixed here.The commit messages/bodies cover the changes in more detail but here's an overview:
parserOptions
is highly dependant on the project details so I removed it here (the existing config caused issues in the design system, for instance). This should be documented but eslint does output a clear error and directions when you haven't configured it in your project.