Skip to content

Conversation

@Marc-Andre-Rivet
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Mar 27, 2021

Addition to #1576 that allows standardizing eslint and prettier configurations across Dash projects.

  • Adds @plotly/eslint-config-dash that exposes two base linting configurations for JavaScript and TypeScript.
  • Adds @plotly/prettier-config-dash that exposes a basic Prettier configuration

These proposed configurations are based on the intersection of the Core's projects current configurations.

Both @plotly/eslint-config-dash and @plotly/prettier-config-dash will need to be published to NPM to be useable and to close this PR.

Percy visual tests will fail because of the un-merged upstream change from py37 to py39.

@Marc-Andre-Rivet Marc-Andre-Rivet changed the base branch from dev to update-toolchain-20210322 March 27, 2021 14:59
@Marc-Andre-Rivet Marc-Andre-Rivet marked this pull request as ready for review March 27, 2021 15:00
"rules": {
"no-constant-condition": 0,
"no-prototype-builtins": 0,
"no-unused-vars": 0,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The renderer's configuration has some peculiarities that shouldn't be generalized to all projects. Also no-unused-vars just acknowledges the current state of the JavaScript code in this project not adhering to this rule.. there's a lot of dangling unused variables in JS files at the moment 😢

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm OK, would be nice to tighten up no-unused-vars at some point, and see whether the others actually have a legitimate reason to be violated. Care to make an issue to follow up on this later?

Copy link
Contributor Author

@Marc-Andre-Rivet Marc-Andre-Rivet May 6, 2021

Choose a reason for hiding this comment

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

I see, I missed a detail here: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md

// note you must disable the base rule as it can report incorrect errors
  "no-unused-vars": "off",

Also used the occasion to fix the .eslintrc config so that it is loaded correctly by VSCode when it references a tsconfig.

2fef7ed

@Marc-Andre-Rivet Marc-Andre-Rivet changed the title Update linting Standardize and share linting rules Mar 27, 2021
@Marc-Andre-Rivet Marc-Andre-Rivet changed the title Standardize and share linting rules Standardize and share Dash linting rules Mar 27, 2021
@@ -0,0 +1,3 @@
# @plotly/prettier-config-dash

Shareable Prettier configuration for Dash projects. No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a big deal, but is it important that this is a separate package? Feels like it would be lighter to use if this were in the same package as the eslint config, and they're intended to be used in tandem.

Copy link
Contributor Author

@Marc-Andre-Rivet Marc-Andre-Rivet May 6, 2021

Choose a reason for hiding this comment

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

The prettier configuration could be added to the eslint-config-... one but it would need to be the default module export (so including "@plotly/eslint-config-dash" in eslint would be invalid and would return the Prettier configuration). It couldn't be the other way around because eslint configs must be published under @<scope>/eslint-config-<package> or eslint-config-<package>. All-in-all agree it would be nice if it could be simpler but given the limitations I think it's best to just keep them separate.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK. I was hoping we could do something like "prettier": "@plotly/eslint-config-dash/prettier" but even if that works it does look a bit odd to have prettier explicitly nested under eslint.

Copy link
Collaborator

@alexcjohnson alexcjohnson 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 couple of small comments. 💃

@Marc-Andre-Rivet Marc-Andre-Rivet merged commit 961e5f9 into update-toolchain-20210322 May 6, 2021
@Marc-Andre-Rivet Marc-Andre-Rivet deleted the update-toolchain-linting branch May 6, 2021 13:05
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.

3 participants