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

[internal] Lint typescript, json, new eslint rules #4449

Merged
merged 26 commits into from
Jul 12, 2019
Merged

Conversation

kuceb
Copy link
Contributor

@kuceb kuceb commented Jun 12, 2019

Part of #2690

the best way to view this PR diff is this filter: https://github.com/cypress-io/cypress/pull/4449/files?file-filters%5B%5D=.json&file-filters%5B%5D=.md&file-filters%5B%5D=.yml&file-filters%5B%5D=dotfile&owned-by%5B%5D=
everything besides that is result of linting

motivation:
with typescript coming in, we need a way to lint it locally, in editor, and in ci. I wanted to use keep using eslint --fix, so we use @ typescript-eslint

changes:

  • all the changes as a result of actually linting everything we want
  • root-level .eslintignore that covers entire monorepo. This is good for editor integration (you'll get red squiggles when you need them, and won't when you don't) and running one eslint command from the root
  • removes subpackages lint commands as the root now lints everything recursively (not the case for coffeelint since it has no ignore file)
  • removes the need for prettier and tslint (expect for cli/types which requires tslint for dtslint)
  • lints and auto-fixes .json or .eslintrc files, sorts package.json, with https://github.com/cypress-io/eslint-plugin-json
  • use lint-staged properly to auto-fix partially staged files

tasks:

  • remove duplicate rules from .eslintrc that are in cypress-dev/general eslint rules

  • merge blankline after multiline expression eslint-plugin-dev#10 to modify eslint rule, release new version

  • update source files with lint changes from blankline after multiline expression eslint-plugin-dev#10

  • use @cypress/eslint-plugin-json to enfore json style across project

  • lint all json

  • rename cypress-dev eslint plugin to @cypress/dev

  • add rule for allowing implicit braces only if oneline

  • wait for new version of @cypress/eslint-plugin-dev to release

  • add .vscode workspace settings for easier vscode setup

.eslintrc Outdated
"arrow-body-style": [
"error",
"always"
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

formatted with default vscode JSON formatter

.eslintrc Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
.eslintrc Outdated Show resolved Hide resolved
@kuceb kuceb mentioned this pull request Jun 13, 2019
17 tasks
@kuceb kuceb requested a review from chrisbreiding June 17, 2019 14:59
.eslintignore Outdated Show resolved Hide resolved
.eslintignore Outdated Show resolved Hide resolved
Copy link
Member

@brian-mann brian-mann left a comment

Choose a reason for hiding this comment

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

let's add a new scripts/eslint-verify-and-fix.js and hook it into circle and npm that both verifies and attempts to --fix.

What this is solving is situations where our base .eslintrc rules change - but then on forked PR's that have diverge - those get "missed".

We want to error during the linting stage, but we also want to provide a really good error message telling the author exactly what went wrong and how to fix it locally and push changes.

IDEA: rather than let the user do this, we could alternatively just use a cypress-bot to automatically push these fixes if we're on a PR.

package.json Outdated Show resolved Hide resolved
@brian-mann
Copy link
Member

Other areas worth exploring...

  • sorting package.json pre-commit or pre-push
  • sorting npm require or imports

Worth verifying...

  • what happens on precommit hooks when there are staged files but only certain lines of the file staged?

@brian-mann
Copy link
Member

brian-mann commented Jun 19, 2019

Also let's...

@kuceb kuceb requested a review from brian-mann June 25, 2019 17:21
@kuceb kuceb changed the title Lint typescript Lint typescript, json, new eslint rules Jun 25, 2019
@kuceb kuceb changed the title Lint typescript, json, new eslint rules Lint typescript, json, new eslint rules [internal] Jun 25, 2019
@brian-mann
Copy link
Member

@bkucera can we disable sourcemaps when building cypress for prod - per our last discussion? That way the eval sourcemaps only affect development.

Copy link
Member

@brian-mann brian-mann left a comment

Choose a reason for hiding this comment

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

This PR is accidentally(?) reverting work done in develop such as changes to the cli/schema/cypress.schema.json found here: https://github.com/cypress-io/cypress/pull/4449/files#diff-4e080e63eb738f2552ed87596970c631

The PR went in a few days ago here: #4300

Why is this happening? What other PR's is this PR overriding?

@kuceb
Copy link
Contributor Author

kuceb commented Jul 3, 2019

@brian-mann my mistake. when i went to re-lint all the files, I git reset to origin/develop without merging it first, then assumed the json files were up to date with develop.

Fixed now

@kuceb
Copy link
Contributor Author

kuceb commented Jul 3, 2019

wow, appveyor.yml thought i was trying to background a process with the '&' in my commit message.
Fixed now

@kuceb kuceb requested a review from brian-mann July 4, 2019 05:35
@kuceb kuceb changed the title Lint typescript, json, new eslint rules [internal] [internal] Lint typescript, json, new eslint rules Jul 9, 2019
@brian-mann brian-mann merged commit fbd5236 into develop Jul 12, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 29, 2019

Released in 3.4.1.

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