Skip to content

Commit

Permalink
Linting Cleanup (#4905)
Browse files Browse the repository at this point in the history
* clean up linting

test

test

test

test

test

test

test

Clean up lint handling

Remove changes

* comment cleanup

* Exclude node_modules in tslint

* Cleanup

* rearrange tests

* Update top level package.json

* spelling error

* Fix scripts

* spelling fix

* Try to exclude node_modules again

* cleanup

* Use explicit tsconfig

* integrity update
  • Loading branch information
blink1073 committed Jul 18, 2018
1 parent 25cc7d3 commit 6d58acf
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 17 deletions.
16 changes: 16 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"linters": {
"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}": [
"prettier --write"
],
"**/*{.ts,.tsx}": [
"tslint --fix -c tsconfig.json",
"git add"
],
"**/*{.js,.jsx}": [
"eslint --fix",
"git add"
]
},
"concurrent": false
}
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ cache:
matrix:
include:
- env: GROUP=js
- env: GROUP=js_cov
- env: GROUP=integrity
- env: GROUP=python
- env: GROUP=js_services
python: 2.7
- env: GROUP=python
python: 3.5
- env: GROUP=python
- env: GROUP=integrity
- env: GROUP=js_services
- env: GROUP=js_cov
- env: GROUP=cli
python: 2.7
- env: GROUP=cli
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
"create:test": "node buildutils/lib/create-test-package.js",
"create:theme": "node buildutils/lib/create-theme.js",
"docs": "lerna run docs",
"eslint": "eslint --fix .",
"eslint:check": "eslint .",
"get:dependency": "node buildutils/lib/get-dependency.js",
"postinstall": "node scripts/ensure-buildutils.js",
"integrity": "node buildutils/lib/ensure-repo.js",
"lint": "jlpm run prettier && jlpm run eslint && jlpm run tslint",
"lint:check": "jlpm run prettier:check && jlpm run eslint:check && jlpm run tslint:check",
"patch:release": "node buildutils/lib/patch-release.js",
"publish": "jlpm run clean:slate && jlpm run build:packages && jlpm integrity && lerna publish --force-publish=* -m \"Publish\"",
"prerelease": "jlpm run clean:slate && jlpm run build:packages && jlpm integrity && lerna publish --npm-tag=next --force-publish=* -m \"Publish Prerelease\"",
Expand All @@ -42,7 +46,10 @@
"test:firefox": "lerna run test:firefox --scope \"@jupyterlab/test-*\" --concurrency 1 --stream",
"test:ie": "lerna run test:ie --scope \"@jupyterlab/test-*\" --concurrency 1 --stream",
"test:services": "cd packages/services && jlpm test && cd examples/node && python main.py",
"tslint": "tslint --fix -c tslint.json '**/*{.ts}'",
"tslint:check": "tslint -c tslint.json '**/*{.ts,.tsx}'",
"prettier": "prettier --write '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}'",
"prettier:check": "prettier --list-different '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}'",
"update:dependency": "node buildutils/lib/update-dependency.js",
"update:dist-tag": "node buildutils/lib/update-dist-tag.js",
"watch": "run-p watch:dev watch:themes",
Expand All @@ -61,17 +68,12 @@
"lint-staged": "^7.1.0",
"npm-run-all": "~4.1.1",
"prettier": "^1.11.1",
"tslint": "~5.10.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.9.0",
"tslint-plugin-prettier": "^1.3.0",
"tslint-react": "^3.6.0",
"yarn": "1.6.0"
},
"lint-staged": {
"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}": [
"prettier --write",
"git add"
]
},
"workspaces": [
"dev_mode",
"examples/*",
Expand Down
7 changes: 2 additions & 5 deletions scripts/travis_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,15 @@ if [[ $GROUP == integrity ]]; then
# Run the integrity script first
jlpm run integrity

# Lint our JavaScript files.
./node_modules/.bin/eslint .
# Lint our files.
jlpm run lint:check

# Build the packages individually.
jlpm run build:src

# Make sure the examples build
jlpm run build:examples

# Run a tslint check
./node_modules/.bin/tslint -c tslint.json -e '**/*.d.ts' -e 'node_modules/**/*.ts' -e 'jupyterlab/**/*.ts' '**/*.ts'

# Make sure we have CSS that can be converted with postcss
jlpm global add postcss-cli

Expand Down
10 changes: 8 additions & 2 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"rulesDirectory": ["tslint-plugin-prettier"],
"rulesDirectory": ["tslint-plugin-prettier", "tslint-react"],
"rules": {
"prettier": [true, { "singleQuote": true }],
"align": [true, "parameters", "statements"],
Expand Down Expand Up @@ -60,7 +60,10 @@
"check-whitespace"
],
"one-variable-per-declaration": [true, "ignore-for-loop"],
"quotemark": [true, "single", "avoid-escape"],
"quotemark": {
"options": [true, "single", "avoid-escape"],
"severity": "off"
},
"radix": true,
"semicolon": [true, "always", "ignore-bound-class-methods"],
"switch-default": true,
Expand Down Expand Up @@ -105,5 +108,8 @@
"check-separator",
"check-type"
]
},
"linterOptions": {
"exclude": ["node_modules/**/*.ts", "**/*.d.ts", "jupyterlab/**/*.ts"]
}
}
29 changes: 29 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9132,6 +9132,29 @@ tslint-plugin-prettier@^1.3.0:
eslint-plugin-prettier "^2.2.0"
tslib "^1.7.1"

tslint-react@^3.6.0:
version "3.6.0"
resolved "https://registry.npmjs.org/tslint-react/-/tslint-react-3.6.0.tgz#7f462c95c4a0afaae82507f06517ff02942196a1"
dependencies:
tsutils "^2.13.1"

tslint@^5.11.0:
version "5.11.0"
resolved "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz#98f30c02eae3cde7006201e4c33cb08b48581eed"
dependencies:
babel-code-frame "^6.22.0"
builtin-modules "^1.1.1"
chalk "^2.3.0"
commander "^2.12.1"
diff "^3.2.0"
glob "^7.1.1"
js-yaml "^3.7.0"
minimatch "^3.0.4"
resolve "^1.3.2"
semver "^5.3.0"
tslib "^1.8.0"
tsutils "^2.27.2"

tslint@~5.10.0:
version "5.10.0"
resolved "https://registry.npmjs.org/tslint/-/tslint-5.10.0.tgz#11e26bccb88afa02dd0d9956cae3d4540b5f54c3"
Expand Down Expand Up @@ -9159,6 +9182,12 @@ tsutils@^2.12.1:
dependencies:
tslib "^1.8.1"

tsutils@^2.13.1, tsutils@^2.27.2:
version "2.28.0"
resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.28.0.tgz#6bd71e160828f9d019b6f4e844742228f85169a1"
dependencies:
tslib "^1.8.1"

tty-browserify@0.0.0:
version "0.0.0"
resolved "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
Expand Down

0 comments on commit 6d58acf

Please sign in to comment.