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
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
458aede
temp 07/01/19 [skip ci] main lint files
kuceb Jul 1, 2019
6cc6bfc
use lint-staged scripts
kuceb Jul 1, 2019
4cf9408
fix all auto-fixable eslint errors
kuceb Jul 1, 2019
a9c4104
manually fix lint issues in files
kuceb Jul 1, 2019
e0d7df7
temp 07/01/19 [skip ci]
kuceb Jul 1, 2019
250f97f
bump eslint plugin versions, update circle.yml
kuceb Jul 2, 2019
fed0625
[lint fix] remaining js files
kuceb Jul 2, 2019
47b6b39
update vscode/settings.json
kuceb Jul 2, 2019
0dd0e69
add back stop-only
kuceb Jul 2, 2019
810ff95
use stop-only for linting .onlys
kuceb Jul 2, 2019
ce4d05f
Merge remote-tracking branch 'origin/develop' into lint-typescript
kuceb Jul 2, 2019
2371e37
fix verify_spec, build_spec
kuceb Jul 2, 2019
5c8d7b4
update json plugin
kuceb Jul 2, 2019
ea65c9a
Merge remote-tracking branch 'origin/develop' into lint-typescript
kuceb Jul 3, 2019
b58f255
relint & apply corrections
kuceb Jul 3, 2019
d259886
fix appveyor.yml not cleansing env vars (very bad)
kuceb Jul 3, 2019
eaade53
dont echo commit message in appveyor script
kuceb Jul 3, 2019
692f3ce
retry build &
kuceb Jul 3, 2019
6ecc644
Merge remote-tracking branch 'origin/develop' into lint-typescript
kuceb Jul 9, 2019
45b1c2e
re-add & upgrade lint-staged
kuceb Jul 9, 2019
283b25c
update contributing docs
kuceb Jul 9, 2019
d532e99
only let stop-only catch staged changes
kuceb Jul 9, 2019
b2bafb5
Merge remote-tracking branch 'origin/develop' into lint-typescript
kuceb Jul 9, 2019
b17c881
Merge remote-tracking branch 'origin/develop' into lint-typescript
kuceb Jul 10, 2019
691e992
Merge remote-tracking branch 'origin/develop' into lint-typescript
kuceb Jul 12, 2019
220f5e8
Merge remote-tracking branch 'origin/develop' into lint-typescript
kuceb Jul 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
temp 07/01/19 [skip ci] main lint files
kuceb committed Jul 1, 2019
commit 458aede95e5231a631d1c3dc2218fcb6fe489809
27 changes: 24 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
__snapshots__
# unignore hidden files
!.*

**/__snapshots__
**/build
**/cypress/fixtures
**/dist
**/dist-test
**/node_modules
**/support/fixtures
**/test/fixtures
**/vendor

# cli/types is linted by tslint/dtslint
cli/types
# packages/example is not linted (think about changing this)
packages/example

packages/extension/test/helpers/background.js
packages/server/lib/scaffold/plugins/index.js
packages/server/lib/scaffold/support/index.js
packages/server/lib/scaffold/support/commands.js
packages/server/test/fixtures
packages/example/cypress

packages/launcher/lib/**/*.js

**/package-lock.json
**/tsconfig.json
73 changes: 5 additions & 68 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,72 +1,9 @@
{
"plugins": [
"@cypress/dev"
],
"extends": [
"plugin:cypress-dev/general"
"plugin:@cypress/dev/general"
],
"rules": {
"no-multiple-empty-lines": ["error", { "max": 1 } ],
"no-else-return": [ "error", { "allowElseIf": false } ],
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
"no-unneeded-ternary": ["error"],
"array-bracket-newline": ["error", "consistent"],
"arrow-body-style": ["error", "always"],
"padding-line-between-statements": [
"error",
{
"blankLine": "always",
"prev": "*",
"next": "return"
},
{
"blankLine": "always",
"prev": [
"const",
"let",
"var",
"if",
"while",
"export",
"cjs-export",
"import",
"cjs-import"
],
"next": "*"
},
{
"blankLine": "any",
"prev": [
"const",
"let",
"var",
"import",
"cjs-import"
],
"next": [
"const",
"let",
"var",
"import",
"cjs-import"
]
}
]
},
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"legacyDecorators": true
}
},
"overrides": [
{
"files": [
"**/*.jsx"
],
"rules": {
"arrow-body-style": "off"
}
}
]
"rules": {}
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ _test-output
cypress.zip
tmp/
.nyc_output
.vscode/settings.json

# from extension
Cached Theme.pak
28 changes: 28 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
},
{
"language": "json",
"autoFix": true
},
{
"language": "coffeescript",
"autoFix": false
}
],
"eslint.options": {
"rules": {
"no-debugger": "off"
}
}
}
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ignore-engines true
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -264,15 +264,16 @@ DEBUG=cypress:launcher
### Coding Style

We use [eslint](https://eslint.org/) to lint all JavaScript code and follow rules specified in
[eslint-plugin-cypress-dev](https://github.com/cypress-io/eslint-plugin-cypress-dev) plugin.
[@cypress/eslint-plugin-dev](https://github.com/cypress-io/cypress-eslint-plugin-dev) plugin.

When you edit files, you can quickly fix all changed files before committing using
When you edit files, you can quickly fix all changed files before you commit using

```bash
npm run lint-changed
npm run lint-changed-fix
```

When committing files, we run Git pre-commit hook to fix the staged JS files. See the `precommit-lint` script in [package.json](package.json). This might change JS files and you would need to commit the changes again.
When committing files, we run a Git pre-commit hook to lint the staged JS files. See the `lint-staged` script in [package.json](package.json).
If this command fails, you may need to run `npm run lint-changed-fix` and commit those changes.

### Tests

5 changes: 2 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -206,7 +206,6 @@ jobs:
- attach_workspace:
at: ~/
- run: npm run lint
- run: npm run all lint

unit-tests:
<<: *defaults
@@ -237,7 +236,7 @@ jobs:
- store_test_results:
path: /tmp/cypress

lint-typescript:
lint-types:
<<: *defaults
parallelism: 1
steps:
@@ -717,7 +716,7 @@ linux-workflow: &linux-workflow
name: Linux lint
requires:
- build
- lint-typescript:
- lint-types:
requires:
- build
# unit, integration and e2e tests
53 changes: 26 additions & 27 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
{
"name": "cypress",
"version": "0.0.0",
"main": "index.js",
"private": true,
"bin": {
"cypress": "bin/cypress"
},
"engines": {
"node": ">=4.0.0"
},
"files": [
"bin",
"lib",
"index.js",
"types/**/*.d.ts"
],
"main": "index.js",
"scripts": {
"prebuild": "npm run test-dependencies && node ./scripts/start-build.js",
"build": "node ./scripts/build.js",
"check-deps": "node ../scripts/check-deps.js --verbose",
"check-deps-pre": "npm run check-deps -- --prescript",
"dtslint": "dtslint types",
"postinstall": "node ./scripts/post-install.js",
"prerelease": "npm run build",
"release": "cd build && releaser --no-node --no-changelog",
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
"pretest": "npm run check-deps-pre",
"test": "npm run test-unit",
"test-debug": "node --inspect --debug-brk $(bin-up _mocha)",
"test-dependencies": "npm run check-deps && dependency-check . --no-dev",
"pretest-unit": "npm run check-deps-pre",
"test-unit": "npm run unit",
"pretest-watch": "npm run check-deps-pre",
"test-watch": "npm run unit -- --watch",
"check-deps": "node ../scripts/check-deps.js --verbose",
"check-deps-pre": "npm run check-deps -- --prescript",
"test-dependencies": "npm run check-deps && dependency-check . --no-dev",
"test-debug": "node --inspect --debug-brk $(bin-up _mocha)",
"unit": "BLUEBIRD_DEBUG=1 NODE_ENV=test bin-up mocha --reporter mocha-multi-reporters --reporter-options configFile=../mocha-reporter-config.json",
"lint": "bin-up eslint --fix *.js scripts/*.js bin/* lib/*.js lib/**/*.js test/*.js test/**/*.js",
"dtslint": "dtslint types",
"prebuild": "npm run test-dependencies && node ./scripts/start-build.js",
"build": "node ./scripts/build.js",
"prerelease": "npm run build",
"release": "cd build && releaser --no-node --no-changelog",
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
"unit": "BLUEBIRD_DEBUG=1 NODE_ENV=test bin-up mocha --reporter mocha-multi-reporters --reporter-options configFile=../mocha-reporter-config.json"
},
"types": "types",
"dependencies": {
"@cypress/listr-verbose-renderer": "0.4.1",
"@cypress/xvfb": "1.2.4",
@@ -58,7 +56,7 @@
"moment": "2.24.0",
"ramda": "0.24.1",
"request": "2.88.0",
"request-progress": "3.0.0",
"request-progress": "0.4.0",
"supports-color": "5.5.0",
"tmp": "0.1.0",
"url": "0.11.0",
@@ -94,10 +92,11 @@
"snap-shot-it": "7.7.1",
"spawn-mock": "1.0.0"
},
"files": [
"bin",
"lib",
"index.js",
"types/**/*.d.ts"
]
"bin": {
"cypress": "bin/cypress"
},
"types": "types",
"engines": {
"node": ">=4.0.0"
}
}
Loading