From e0f578c135eab685c8c587e48c927e3c09277f2b Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Mon, 8 Jan 2024 08:26:25 -0500 Subject: [PATCH] Start linting with lit-analyzer (#19302) --- .github/workflows/ci.yaml | 2 ++ lint-staged.config.js | 1 + package.json | 4 ++-- tsconfig.json | 24 +++++++++++++++++------- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index af8a338903..85f34c0288 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,6 +48,8 @@ jobs: run: yarn run lint:eslint --quiet - name: Run tsc run: yarn run lint:types + - name: Run lit-analyzer + run: yarn run lint:lit --quiet - name: Run prettier run: yarn run lint:prettier test: diff --git a/lint-staged.config.js b/lint-staged.config.js index 8740aaab19..5359a96eee 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -2,6 +2,7 @@ export default { "*.?(c|m){js,ts}": [ "eslint --cache --cache-strategy=content --cache-location=node_modules/.cache/eslint/.eslintcache --fix", "prettier --cache --write", + "lit-analyzer", ], "*.{json,css,md,markdown,html,y?aml}": "prettier --cache --write", "translations/*/*.json": (files) => diff --git a/package.json b/package.json index 818fa25fa1..b591fab97d 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "lint:prettier": "prettier . --cache --check", "format:prettier": "prettier . --cache --write", "lint:types": "tsc", - "lint:lit": "lit-analyzer \"**/src/**/*.ts\" --format markdown --outFile result.md", - "lint": "yarn run lint:eslint && yarn run lint:prettier && yarn run lint:types", + "lint:lit": "lit-analyzer \"{.,*}/src/**/*.ts\"", + "lint": "yarn run lint:eslint && yarn run lint:prettier && yarn run lint:types && yarn run lint:lit", "format": "yarn run format:eslint && yarn run format:prettier", "postinstall": "husky install", "prepack": "pinst --disable", diff --git a/tsconfig.json b/tsconfig.json index a5bac525d4..0a45a72573 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,15 +25,25 @@ "plugins": [ { "name": "ts-lit-plugin", - "strict": false, + "strict": true, "rules": { - "no-unknown-tag-name": "error", - "no-missing-import": "error", - "no-unclosed-tag": "error", - "no-incompatible-type-binding": "warning", - "no-invalid-css": "warning", + // Custom elements + "no-unclosed-tag": "warning", "no-missing-element-type-definition": "warning", - "no-property-visibility-mismatch": "error" + // Binding names + "no-legacy-attribute": "error", + // Binding types + "no-boolean-in-attribute-binding": "warning", + "no-expressionless-property-binding": "warning", + "no-complex-attribute-binding": "warning", + "no-nullable-attribute-binding": "warning", + "no-incompatible-type-binding": "warning", + "no-invalid-directive-binding": "warning", + // LitElement + "no-incompatible-property-type": "warning", + "no-property-visibility-mismatch": "warning", + // CSS + "no-invalid-css": "off" // warning does not work } } ]