From 45e11481c99ef0a7a5e3230f459d925488ebdcc4 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 12 Aug 2019 15:55:32 -0700 Subject: [PATCH 1/2] Add lit-analyzer to linting - Set up linting in Travis as well --- .travis.yml | 4 ++ CHANGELOG.md | 1 + package-lock.json | 120 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- 4 files changed, 128 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 99a2d05524..e4fc39cf3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,3 +8,7 @@ addons: before_script: - npm run bootstrap + +script: + - npm run lint + - npm test \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1183993a29..8672f623ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix bug where `` `open` method threw if called immediately after construction (before `firstUpdated`). - Add support for `` and `` to `` +- Add `lit-analyzer` to CI ## [0.6.0] - 2019-06-05 - Upgrade lerna to 3.x diff --git a/package-lock.json b/package-lock.json index afcff85ffd..094a15e8d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6049,6 +6049,17 @@ "kuler": "1.0.x" } }, + "didyoumean2": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/didyoumean2/-/didyoumean2-2.0.4.tgz", + "integrity": "sha512-eLbnl2R3Xi1mDz3/a8qfMyVqNDrKvZVi2qpDKtK3mAwscweL7hkIb6Ub4FY6mYLyK/9489bQfJ0YMtHzIJskpQ==", + "dev": true, + "requires": { + "leven": "^2.0.0", + "lodash.deburr": "^4.1.0", + "ramda": "^0.26.1" + } + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -10528,6 +10539,12 @@ "npmlog": "^4.1.2" } }, + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", + "dev": true + }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -10610,6 +10627,53 @@ "immediate": "~3.0.5" } }, + "lit-analyzer": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/lit-analyzer/-/lit-analyzer-1.1.7.tgz", + "integrity": "sha512-lKZtP3kgk4HfdTR+l2Y7IM1f5sucJW+BZlJOXuDp1lz9j1QGhkTkIcBPQO6h8k2vXcvvhjk5Pn68QKpi4Q6GNA==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "didyoumean2": "2.0.4", + "fast-glob": "^2.2.6", + "parse5": "5.1.0", + "ts-simple-type": "~0.3.5", + "vscode-css-languageservice": "4.0.2-next.1", + "vscode-html-languageservice": "2.1.12", + "web-component-analyzer": "~0.1.11" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -10673,6 +10737,12 @@ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, + "lodash.deburr": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz", + "integrity": "sha1-3bG7s+8HRYwBd7oH3hRCLLAz/5s=", + "dev": true + }, "lodash.defaults": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", @@ -15468,6 +15538,12 @@ "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==", "dev": true }, + "ts-simple-type": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/ts-simple-type/-/ts-simple-type-0.3.5.tgz", + "integrity": "sha512-e5QYiZDWVktUDmYYO0zifyD6ze2xweGbQSsoDqFuwOh21Dhgc2wOZjp1psu9WuT7iBOTh+LHLYPmE1XZGMqzdg==", + "dev": true + }, "tslib": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", @@ -16015,6 +16091,39 @@ "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", "dev": true }, + "vscode-css-languageservice": { + "version": "4.0.2-next.1", + "resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-4.0.2-next.1.tgz", + "integrity": "sha512-45Rk8IBgvOfesTRLlIQs0g8OMuiubRazqa09cyAZO4aObAYUTMFQr/JDPz3jB+mB7qWpAip90x80gJ8MVw22vA==", + "dev": true, + "requires": { + "vscode-languageserver-types": "^3.14.0", + "vscode-nls": "^4.0.0" + } + }, + "vscode-html-languageservice": { + "version": "2.1.12", + "resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-2.1.12.tgz", + "integrity": "sha512-mIb5VMXM5jI97HzCk2eadI1K//rCEZXte0wBqA7PGXsyJH4KTyJUaYk9MR+mbfpUl2vMi3HZw9GUOLGYLc6l5w==", + "dev": true, + "requires": { + "vscode-languageserver-types": "^3.13.0", + "vscode-nls": "^4.0.0", + "vscode-uri": "^1.0.6" + } + }, + "vscode-languageserver-types": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", + "integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A==", + "dev": true + }, + "vscode-nls": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-4.1.1.tgz", + "integrity": "sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==", + "dev": true + }, "vscode-uri": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.8.tgz", @@ -16039,6 +16148,17 @@ "defaults": "^1.0.3" } }, + "web-component-analyzer": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/web-component-analyzer/-/web-component-analyzer-0.1.15.tgz", + "integrity": "sha512-jVgN2sVaPQqA5Y7TcYlSUdzTkUzWzIMGEsUeCxdki1kdhTBbe0Ij5jcNn3LYh5Kx9mAGutKIAua4UQ8Y8+Vvrw==", + "dev": true, + "requires": { + "fast-glob": "^2.2.6", + "ts-simple-type": "~0.3.5", + "typescript": "^3.5.1" + } + }, "webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", diff --git a/package.json b/package.json index 5dae67b4a4..af646d2e16 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,9 @@ "dev": "polyserve --npm --module-resolution=node", "format": "clang-format --version; find . -name '*.ts' | grep -v node_modules | xargs clang-format -style=file -i", "lint:imports": "node scripts/check-imports.js", - "lint": "npm run lint:typescript", + "lint": "npm run lint:typescript && npm run lint:lit", "lint:typescript": "eslint \"packages/**/*.ts\"", + "lint:lit": "lit-analyzer \"packages/**/*.ts\" --strict --quiet", "test": "karma start --single-run", "test:bench": "node test/benchmark/cli.js", "bootstrap": "npm install && ./scripts/bootstrap.sh && npm run build", @@ -56,6 +57,7 @@ "karma-sauce-launcher": "^2.0.2", "karma-sourcemap-loader": "^0.3.7", "lerna": "^3.13.1", + "lit-analyzer": "^1.1.7", "mocha": "^5.0.0", "node-sass-import": "^2.0.1", "node-watch": "^0.6.0", From b38f3813d6660ecf30dcda5980c78dd572fe8325 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 12 Aug 2019 16:12:50 -0700 Subject: [PATCH 2/2] Break out `build` from `bootstrap` Run format in CI --- .travis.yml | 3 +++ CHANGELOG.md | 2 ++ README.md | 2 +- package.json | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4fc39cf3f..14f00a87aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,9 @@ addons: before_script: - npm run bootstrap + - >- + npm run format && git diff --exit-code || (echo -e '\n\033[31mERROR:\033[0m + Project is not formatted. Please run "npm run format".' && false) script: - npm run lint diff --git a/CHANGELOG.md b/CHANGELOG.md index 8672f623ad..2b3b540a4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). after construction (before `firstUpdated`). - Add support for `` and `` to `` - Add `lit-analyzer` to CI +- Only set up structure in `bootstrap`, make `build` explicit. + Run `lint` and `format` in CI ## [0.6.0] - 2019-06-05 - Upgrade lerna to 3.x diff --git a/README.md b/README.md index b0b3fa0881..14600eb5aa 100644 --- a/README.md +++ b/README.md @@ -74,10 +74,10 @@ Below are instructions for setting up project development. 1. Clone this repo with `git clone`. 1. Install dependencies by running `npm run bootstrap` +1. Build the project with `npm run build` 1. Run a development server with `npm run dev` - View the demos by accessing ``/demos/index.html - This will also build the project. -1. Build the project with `npm run build` 1. Run tests with `npm run test` 1. Run benchmarks with `npm run build:tests && npm run test:bench` diff --git a/package.json b/package.json index af646d2e16..eda0f67986 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "lint:lit": "lit-analyzer \"packages/**/*.ts\" --strict --quiet", "test": "karma start --single-run", "test:bench": "node test/benchmark/cli.js", - "bootstrap": "npm install && ./scripts/bootstrap.sh && npm run build", - "build": "npm run lint && npm run build:styling && npm run build:typescript -- --verbose", + "bootstrap": "npm install && ./scripts/bootstrap.sh", + "build": "npm run build:styling && npm run build:typescript -- --verbose", "build:styling": "./scripts/build-styling.sh", "build:typescript": "tsc --build packages/**/tsconfig.json", "build:tests": "tsc --build test/tsconfig.json && tsc --build test/tsconfig-node.json",