From 1487e0a1e9b753b53e95e1669ed996306bee71a0 Mon Sep 17 00:00:00 2001 From: iambumblehead Date: Wed, 29 Nov 2023 05:03:07 -0800 Subject: [PATCH] chore(tools): lint all files, simplify npm lint script command (#1074) Co-authored-by: chris --- .eslintrc.json | 24 ++++++++++++++++++++++-- CHANGELOG.md | 12 +++++++----- package.json | 2 +- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 596f7b4..4f4ef20 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,7 +2,6 @@ "root": true, "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], - "ignorePatterns": ["build"], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", @@ -15,10 +14,16 @@ "browser": true, "node": false }, - "ignorePatterns": ["browserstack-browsers.js", "web-test-runner.config.js"], + "ignorePatterns": [ + "browserstack-browsers.js", + "web-test-runner.config.js", + "build", + "coverage" + ], "overrides": [ { "files": ["*.ts", "*.tsx"], + "excludedFiles": ["README*/**"], "parserOptions": { "project": ["./tsconfig.json", "test/tsconfig.json"] }, @@ -63,6 +68,21 @@ "rules": { "@typescript-eslint/no-var-requires": "off" } + }, + { + "files": ["README*md/*.tsx"], + "rules": { + "@typescript-eslint/no-unused-vars": "off", + "import/no-unresolved": "off" + } + }, + { + "files": ["CHANGELOG.md/*"], + "rules": { + "@typescript-eslint/no-unused-vars": "off", + "import/no-unresolved": "off", + "node/no-missing-import": "off" + } } ], "rules": { diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ba4331..5dea949 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -234,7 +234,7 @@ Whether or not to set a boolean attribute is now determined by looking at the va ```js h("div", { attrs: { - foo: true // will be set a boolean attribute since `true` is a boolean + foo: true, // will be set a boolean attribute since `true` is a boolean bar: "baz" // will set a normal attribute } }); @@ -366,10 +366,12 @@ The biggest change in this release is that the Snabbdom source code has been por The TypeScript rewrite uses the `import` and `export` features introduced in ECMAScript 2015. Unfortunately the ES imports have no analogy to the CommonJS pattern of setting `module.exports`. This means that the Snabbdom modules that previously used this feature now have to be imported in a slightly different way. ```js -var h = require("snabbdom/h"); // The old way -var h = require("snabbdom/h").h; // The new way -var h = require("snabbdom/h").default; // Alternative new way -var { h } = require("snabbdom/h"); // Using destructuring +/* eslint-disable no-redeclare */ +const h = require("snabbdom/h"); // The old way +const h = require("snabbdom/h").h; // The new way +const h = require("snabbdom/h").default; // Alternative new way +const { h } = require("snabbdom/h"); // Using destructuring +/* eslint-enable no-redeclare */ ``` ## [v0.6.0] - 2017-01-05 diff --git a/package.json b/package.json index 5359828..9279151 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "format": "prettier --write .", "format-check": "prettier --check .", "prepare": "husky install", - "lint": "eslint --ext .ts,.tsx,.js --ignore-path .gitignore .", + "lint": "eslint .", "unit": "web-test-runner \"test/unit/*.{ts,tsx}\" --node-resolve --coverage", "release": "npm run test && release-it", "test": "npm run build && npm run lint && npm run unit",