From cde139a12db36332eff0e4f67f46275f73dc582d Mon Sep 17 00:00:00 2001 From: Milan Raj Date: Mon, 13 Jan 2025 15:52:02 -0600 Subject: [PATCH] Enable linting (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request ## 📖 Description Enables linting infrastructure - Adds `npm run lint` and `npm run test` commands - Enables eslint ## ⏭ Next Steps Remaining lint work: - Enable fast-web-utilities linting - Enable prettier --- .eslintrc.js | 2 +- .github/workflows/main.yml | 2 +- ...-fast-colors-f6a2c094-ddbf-4ea5-b7bf-a4ba1acd9503.json | 7 +++++++ ...fast-element-d656cdbb-03f7-4b1e-9855-1e8face304a9.json | 7 +++++++ ...t-foundation-2a30a313-fd12-42c3-a832-748b37cc4207.json | 7 +++++++ ...eact-wrapper-384c6b04-0717-49a5-a986-bff433c3008c.json | 7 +++++++ ...eb-utilities-043b70b1-a31f-4276-849b-4986788b6e72.json | 7 +++++++ package.json | 3 +++ packages/utilities/fast-colors/.eslintrc.json | 2 +- packages/utilities/fast-colors/package.json | 4 +++- packages/utilities/fast-react-wrapper/.eslintrc.json | 2 +- packages/utilities/fast-react-wrapper/package.json | 8 +++++--- packages/utilities/fast-web-utilities/.eslintrc.json | 2 +- packages/utilities/fast-web-utilities/package.json | 4 +++- packages/web-components/fast-element/.eslintrc.json | 2 +- packages/web-components/fast-element/package.json | 8 +++++--- packages/web-components/fast-foundation/.eslintrc.json | 2 +- packages/web-components/fast-foundation/package.json | 8 +++++--- packages/web-components/fast-foundation/src/tabs/tabs.ts | 1 - 19 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 change/@ni-fast-colors-f6a2c094-ddbf-4ea5-b7bf-a4ba1acd9503.json create mode 100644 change/@ni-fast-element-d656cdbb-03f7-4b1e-9855-1e8face304a9.json create mode 100644 change/@ni-fast-foundation-2a30a313-fd12-42c3-a832-748b37cc4207.json create mode 100644 change/@ni-fast-react-wrapper-384c6b04-0717-49a5-a986-bff433c3008c.json create mode 100644 change/@ni-fast-web-utilities-043b70b1-a31f-4276-849b-4986788b6e72.json diff --git a/.eslintrc.js b/.eslintrc.js index 8712625260a..f6ae784f95f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,3 @@ module.exports = { - extends: ["@microsoft/eslint-config-fast-dna", "prettier"], + extends: ["@ni/eslint-config-fast-dna", "prettier"], }; diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 225b36c6c59..aa7d374d7b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,7 +64,7 @@ jobs: if-no-files-found: error # Validate (Lint and Test) - # - run: npm run lint + - run: npm run lint # - run: npm run test # Check Changelog diff --git a/change/@ni-fast-colors-f6a2c094-ddbf-4ea5-b7bf-a4ba1acd9503.json b/change/@ni-fast-colors-f6a2c094-ddbf-4ea5-b7bf-a4ba1acd9503.json new file mode 100644 index 00000000000..a940c5e182a --- /dev/null +++ b/change/@ni-fast-colors-f6a2c094-ddbf-4ea5-b7bf-a4ba1acd9503.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Dev only changes from lint", + "packageName": "@ni/fast-colors", + "email": "rajsite@users.noreply.github.com", + "dependentChangeType": "none" +} diff --git a/change/@ni-fast-element-d656cdbb-03f7-4b1e-9855-1e8face304a9.json b/change/@ni-fast-element-d656cdbb-03f7-4b1e-9855-1e8face304a9.json new file mode 100644 index 00000000000..ca13a688eee --- /dev/null +++ b/change/@ni-fast-element-d656cdbb-03f7-4b1e-9855-1e8face304a9.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Dev only changes from lint", + "packageName": "@ni/fast-element", + "email": "rajsite@users.noreply.github.com", + "dependentChangeType": "none" +} diff --git a/change/@ni-fast-foundation-2a30a313-fd12-42c3-a832-748b37cc4207.json b/change/@ni-fast-foundation-2a30a313-fd12-42c3-a832-748b37cc4207.json new file mode 100644 index 00000000000..bc5487ceaed --- /dev/null +++ b/change/@ni-fast-foundation-2a30a313-fd12-42c3-a832-748b37cc4207.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Minor lint change to remove unused import", + "packageName": "@ni/fast-foundation", + "email": "rajsite@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/change/@ni-fast-react-wrapper-384c6b04-0717-49a5-a986-bff433c3008c.json b/change/@ni-fast-react-wrapper-384c6b04-0717-49a5-a986-bff433c3008c.json new file mode 100644 index 00000000000..1704df2e611 --- /dev/null +++ b/change/@ni-fast-react-wrapper-384c6b04-0717-49a5-a986-bff433c3008c.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Dev only changes from lint", + "packageName": "@ni/fast-react-wrapper", + "email": "rajsite@users.noreply.github.com", + "dependentChangeType": "none" +} diff --git a/change/@ni-fast-web-utilities-043b70b1-a31f-4276-849b-4986788b6e72.json b/change/@ni-fast-web-utilities-043b70b1-a31f-4276-849b-4986788b6e72.json new file mode 100644 index 00000000000..ec9a44c4b2a --- /dev/null +++ b/change/@ni-fast-web-utilities-043b70b1-a31f-4276-849b-4986788b6e72.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Dev only changes from lint", + "packageName": "@ni/fast-web-utilities", + "email": "rajsite@users.noreply.github.com", + "dependentChangeType": "none" +} diff --git a/package.json b/package.json index 086621da140..2e1eb783b41 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,9 @@ "scripts": { "build": "npm run build --workspaces --if-present", "pack": "npm run pack --workspaces --if-present", + "lint": "npm run lint --workspaces --if-present", + "format": "npm run format --workspaces --if-present", + "test": "npm run test --workspaces --if-present", "change": "beachball change", "check": "beachball check --changehint \"Run 'npm run change' to generate a change file\"", "sync": "beachball sync", diff --git a/packages/utilities/fast-colors/.eslintrc.json b/packages/utilities/fast-colors/.eslintrc.json index ea40c852980..3254ff2c28c 100644 --- a/packages/utilities/fast-colors/.eslintrc.json +++ b/packages/utilities/fast-colors/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["@microsoft/eslint-config-fast-dna", "prettier"], + "extends": ["@ni/eslint-config-fast-dna", "prettier"], "rules": { "@typescript-eslint/no-non-null-assertion": "off", "import/extensions": [ diff --git a/packages/utilities/fast-colors/package.json b/packages/utilities/fast-colors/package.json index 2054e7894a8..d8b07f8386d 100644 --- a/packages/utilities/fast-colors/package.json +++ b/packages/utilities/fast-colors/package.json @@ -23,12 +23,14 @@ "scripts": { "build": "npm run clean:dist && tsc -p ./tsconfig.build.json && npm run doc", "pack": "npm pack", + "lint": "npm run eslint", + "format": "npm run eslint:fix", + "test": "npm run build:tests && npm run unit-tests", "build:tests": "npm run clean:dist && tsc -p ./tsconfig.test.json && npm run doc", "clean:dist": "node ../../../build/clean.js dist", "doc": "api-extractor run --local", "prettier": "prettier --config ../../../.prettierrc --write \"**/*.ts\"", "prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different", - "test": "npm run build:tests && npm run eslint && npm run unit-tests", "eslint": "eslint . --ext .ts", "eslint:fix": "eslint . --ext .ts --fix", "unit-tests": "mocha", diff --git a/packages/utilities/fast-react-wrapper/.eslintrc.json b/packages/utilities/fast-react-wrapper/.eslintrc.json index 42fbdf1f16c..f8c69f7e045 100644 --- a/packages/utilities/fast-react-wrapper/.eslintrc.json +++ b/packages/utilities/fast-react-wrapper/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["@microsoft/eslint-config-fast-dna", "prettier"], + "extends": ["@ni/eslint-config-fast-dna", "prettier"], "rules": { "import/extensions": [ "error", diff --git a/packages/utilities/fast-react-wrapper/package.json b/packages/utilities/fast-react-wrapper/package.json index 7a84504abe2..9d82a820e91 100644 --- a/packages/utilities/fast-react-wrapper/package.json +++ b/packages/utilities/fast-react-wrapper/package.json @@ -22,17 +22,19 @@ "types": "dist/fast-react-wrapper.d.ts", "unpkg": "dist/fast-react-wrapper.min.js", "scripts": { - "clean:dist": "node ../../../build/clean.js dist", - "doc": "api-extractor run --local", "build": "npm run clean:dist && tsc -p ./tsconfig.json && rollup -c && npm run doc", "pack": "npm pack", + "lint": "npm run eslint", + "format": "npm run eslint:fix", + "test": "npm run test-chrome:verbose", + "clean:dist": "node ../../../build/clean.js dist", + "doc": "api-extractor run --local", "dev": "tsc -p ./tsconfig.json -w", "tdd": "npm run dev & npm run test-chrome:watch", "prettier": "prettier --config ../../../.prettierrc --write \"**/*.ts\"", "prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different", "eslint": "eslint . --ext .ts", "eslint:fix": "eslint . --ext .ts --fix", - "test": "npm run eslint && npm run test-chrome:verbose", "test-node": "mocha --reporter min --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'", "test-node:verbose": "mocha --reporter spec --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'", "test-chrome": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --single-run --coverage", diff --git a/packages/utilities/fast-web-utilities/.eslintrc.json b/packages/utilities/fast-web-utilities/.eslintrc.json index 42fbdf1f16c..f8c69f7e045 100644 --- a/packages/utilities/fast-web-utilities/.eslintrc.json +++ b/packages/utilities/fast-web-utilities/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["@microsoft/eslint-config-fast-dna", "prettier"], + "extends": ["@ni/eslint-config-fast-dna", "prettier"], "rules": { "import/extensions": [ "error", diff --git a/packages/utilities/fast-web-utilities/package.json b/packages/utilities/fast-web-utilities/package.json index 1da9eac5fc3..40739a8c32a 100644 --- a/packages/utilities/fast-web-utilities/package.json +++ b/packages/utilities/fast-web-utilities/package.json @@ -23,10 +23,12 @@ "scripts": { "build": "npm run clean:dist && tsc -p ./tsconfig.build.json", "pack": "npm pack", + "lint": "echo \"TODO: fix eslint execution\"", + "format": "npm run eslint:fix", + "test": "npm run build && npm run test-chrome:verbose", "clean:dist": "node ../../../build/clean.js dist", "prettier": "prettier --config ../../../.prettierrc --write \"**/*.ts\"", "prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different", - "test": "npm run eslint && npm run build && npm run test-chrome:verbose", "test-node": "mocha --reporter min --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'", "test-node:verbose": "mocha --reporter spec --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'", "test-chrome": "karma start karma.conf.ts --browsers=ChromeHeadlessOpt --single-run --coverage", diff --git a/packages/web-components/fast-element/.eslintrc.json b/packages/web-components/fast-element/.eslintrc.json index cb11089e167..7fef5b7ecf6 100644 --- a/packages/web-components/fast-element/.eslintrc.json +++ b/packages/web-components/fast-element/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["@microsoft/eslint-config-fast-dna", "prettier"], + "extends": ["@ni/eslint-config-fast-dna", "prettier"], "rules": { "max-classes-per-file": "off", "no-case-declarations": "off", diff --git a/packages/web-components/fast-element/package.json b/packages/web-components/fast-element/package.json index f4ed9d86723..e2269443edd 100644 --- a/packages/web-components/fast-element/package.json +++ b/packages/web-components/fast-element/package.json @@ -22,10 +22,13 @@ "type": "module", "unpkg": "dist/fast-element.min.js", "scripts": { - "clean:dist": "node ../../../build/clean.js dist", - "doc": "api-extractor run --local", "build": "npm run clean:dist && npm run build:tsc && npm run build:rollup && npm run doc", "pack": "npm pack", + "lint": "npm run eslint", + "format": "npm run eslint:fix", + "test": "npm run test-chrome:verbose", + "clean:dist": "node ../../../build/clean.js dist", + "doc": "api-extractor run --local", "build:rollup": "rollup -c", "build:tsc": "tsc -p ./tsconfig.json", "dev": "tsc -p ./tsconfig.json -w", @@ -34,7 +37,6 @@ "prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different", "eslint": "eslint . --ext .ts", "eslint:fix": "eslint . --ext .ts --fix", - "test": "npm run eslint && npm run test-chrome:verbose", "test-node": "mocha --reporter min --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'", "test-node:verbose": "mocha --reporter spec --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'", "test-chrome": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --single-run --coverage", diff --git a/packages/web-components/fast-foundation/.eslintrc.json b/packages/web-components/fast-foundation/.eslintrc.json index fd9147f2761..5173d578980 100644 --- a/packages/web-components/fast-foundation/.eslintrc.json +++ b/packages/web-components/fast-foundation/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["@microsoft/eslint-config-fast-dna", "prettier"], + "extends": ["@ni/eslint-config-fast-dna", "prettier"], "rules": { "@typescript-eslint/class-name-casing": "off", "@typescript-eslint/naming-convention": [ diff --git a/packages/web-components/fast-foundation/package.json b/packages/web-components/fast-foundation/package.json index eb4d0d79abc..54dc7ef553f 100644 --- a/packages/web-components/fast-foundation/package.json +++ b/packages/web-components/fast-foundation/package.json @@ -22,12 +22,15 @@ "unpkg": "dist/fast-foundation.min.js", "type": "module", "scripts": { + "build": "npm run clean:dist && npm run build:tsc && npm run build:rollup && npm run doc", + "pack": "npm pack", + "lint": "npm run eslint", + "format": "npm run eslint:fix", + "test": "npm run test-chrome:verbose", "clean:dist": "node ../../../build/clean.js dist", "doc": "api-extractor run --local", "build:rollup": "rollup -c", "build:tsc": "tsc -p ./tsconfig.json", - "build": "npm run clean:dist && npm run build:tsc && npm run build:rollup && npm run doc", - "pack": "npm pack", "dev": "tsc -p ./tsconfig.json -w", "tdd": "npm run dev & npm run test-chrome:watch", "tdd:firefox": "npm run dev & npm run test-firefox:watch", @@ -35,7 +38,6 @@ "prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different", "eslint": "eslint . --ext .ts", "eslint:fix": "eslint . --ext .ts --fix", - "test": "npm run eslint && npm run test-chrome:verbose", "test-node": "mocha --reporter min --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'", "test-node:verbose": "mocha --reporter spec --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'", "test-chrome": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --single-run --coverage", diff --git a/packages/web-components/fast-foundation/src/tabs/tabs.ts b/packages/web-components/fast-foundation/src/tabs/tabs.ts index 99653bea667..8a6dcd8d05b 100644 --- a/packages/web-components/fast-foundation/src/tabs/tabs.ts +++ b/packages/web-components/fast-foundation/src/tabs/tabs.ts @@ -8,7 +8,6 @@ import { keyHome, limit, uniqueId, - wrapInBounds, } from "@ni/fast-web-utilities"; import { StartEnd, StartEndOptions } from "../patterns/start-end.js"; import { applyMixins } from "../utilities/apply-mixins.js";