From fd63f19cbc45828821b8eb8ccf3237f94fbffeeb Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 2 Jun 2023 16:47:02 -0400 Subject: [PATCH] chore: enable caching for lint task (#26791) --- .eslintrc.js | 1 - cli/package.json | 8 ++++++++ lerna.json | 3 ++- npm/angular/src/mount.ts | 1 + nx.json | 41 ++++++++++++++++++++++++++++++++++++++-- package.json | 7 ++++--- scripts/.eslintrc | 17 +++++++++++++++++ scripts/package.json | 6 ++++++ 8 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 scripts/.eslintrc create mode 100644 scripts/package.json diff --git a/.eslintrc.js b/.eslintrc.js index 5c469c301940..12aa005137ac 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -57,7 +57,6 @@ module.exports = { rules: { 'no-restricted-properties': 'off', 'no-restricted-syntax': 'off', - 'no-console': 'off', }, }, ], diff --git a/cli/package.json b/cli/package.json index f9c2d09f146b..f968022a5979 100644 --- a/cli/package.json +++ b/cli/package.json @@ -66,7 +66,15 @@ "devDependencies": { "@babel/cli": "7.13.0", "@babel/preset-env": "7.13.5", + "@cypress/angular": "0.0.0-development", + "@cypress/grep": "0.0.0-development", + "@cypress/mount-utils": "0.0.0-development", + "@cypress/react": "0.0.0-development", + "@cypress/react18": "0.0.0-development", "@cypress/sinon-chai": "2.9.1", + "@cypress/svelte": "0.0.0-development", + "@cypress/vue": "0.0.0-development", + "@cypress/vue2": "0.0.0-development", "@packages/root": "0.0.0-development", "@types/bluebird": "3.5.33", "@types/chai": "4.2.15", diff --git a/lerna.json b/lerna.json index 32d413dffbff..a1cac42c5796 100644 --- a/lerna.json +++ b/lerna.json @@ -5,7 +5,8 @@ "packages/*", "npm/*", "tooling/*", - "system-tests" + "system-tests", + "scripts" ], "useWorkspaces": true, "useNx": true, diff --git a/npm/angular/src/mount.ts b/npm/angular/src/mount.ts index aeeb9c883a1b..8ba0f0dab89a 100644 --- a/npm/angular/src/mount.ts +++ b/npm/angular/src/mount.ts @@ -116,6 +116,7 @@ export type MountResponse = { // 'zone.js/testing' is not properly aliasing `it.skip` but it does provide `xit`/`xspecify` // Written up under https://github.com/angular/angular/issues/46297 but is not seeing movement // so we'll patch here pending a fix in that library +// @ts-ignore Ignore so that way we can bypass semantic error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. globalThis.it.skip = globalThis.xit @Injectable() diff --git a/nx.json b/nx.json index 76786f62c297..95b555823a81 100644 --- a/nx.json +++ b/nx.json @@ -3,9 +3,46 @@ "default": { "runner": "nx-cloud", "options": { - "cacheableOperations": [], + "cacheableOperations": [ + "lint" + ], "accessToken": "ZmNlNjA0YzAtNTM1NS00MDIwLWFlMWItNWYxYzNiMjQ4N2VkfHJlYWQtb25seQ==" } } + }, + "targetDefaults": { + "lint": { + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.js" + ] + }, + "build": { + "dependsOn": [ + "^build" + ] + }, + "build-prod": { + "dependsOn": [ + "^build-prod" + ] + } + }, + "namedInputs": { + "sharedGlobals": [], + "default": [ + "{projectRoot}/**/*", + "sharedGlobals" + ], + "production": [ + "default", + "!{projectRoot}/**/*.spec.ts", + "!{projectRoot}/**/*.md", + "!{projectRoot}/tsconfig.spec.json", + "!{projectRoot}/.eslintrc.json", + "!{projectRoot}/.mocharc.{js,json}", + "!{projectRoot/cypress.config.{ts,js}", + "!{projectRoot/**/*.cy.ts" + ] } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 1f7c5b11ca1b..5fac7b5ddb3d 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "binary-upload": "node ./scripts/binary.js upload", "binary-zip": "node ./scripts/binary.js zip", "build": "yarn build-npm-modules && lerna run build --stream --no-bail --ignore create-cypress-tests --ignore cypress --ignore \"'@packages/{runner}'\" --ignore \"'@cypress/{angular,react,react18,vue,vue2,mount-utils,svelte}'\" && node ./cli/scripts/post-build.js && lerna run build --stream --scope create-cypress-tests", - "build-npm-modules": "lerna run build --scope cypress --scope @cypress/mount-utils && lerna run build --scope \"'@cypress/{angular,react,react18,vue,vue2,svelte}'\"", + "build-npm-modules": "lerna run build --scope cypress --scope @cypress/mount-utils --scope @cypress/react && lerna run build --scope \"'@cypress/{angular,react18,vue,vue2,svelte}'\"", "build-prod": "lerna run build-prod-ui --stream && lerna run build-prod --stream --ignore create-cypress-tests && node ./cli/scripts/post-build.js && lerna run build-prod --stream --scope create-cypress-tests --scope", "build-v8-snapshot-dev": "node --max-old-space-size=8192 tooling/v8-snapshot/scripts/setup-v8-snapshot-in-cypress.js --env=dev", "build-v8-snapshot-prod": "node --max-old-space-size=8192 tooling/v8-snapshot/scripts/setup-v8-snapshot-in-cypress.js", @@ -41,7 +41,7 @@ "ensure-deps": "./scripts/ensure-dependencies.sh", "get-next-version": "node scripts/get-next-version.js", "postinstall": "node ./scripts/run-postInstall.js", - "lint": "lerna run lint --no-bail --concurrency 2 && eslint --ext .js,.ts,.json, scripts", + "lint": "lerna run lint --no-bail --concurrency 2", "prepare-release-artifacts": "node ./scripts/prepare-release-artifacts.js", "npm-release": "node scripts/npm-release.js", "prestart": "yarn ensure-deps", @@ -244,7 +244,8 @@ "packages/*", "npm/*", "tooling/*", - "system-tests" + "system-tests", + "scripts" ], "nohoist": [ "**/webpack-preprocessor/babel-loader", diff --git a/scripts/.eslintrc b/scripts/.eslintrc new file mode 100644 index 000000000000..6dd6b19c2124 --- /dev/null +++ b/scripts/.eslintrc @@ -0,0 +1,17 @@ +{ + "plugins": [ + "cypress", + "@cypress/dev" + ], + "extends": [ + "plugin:@cypress/dev/general", + "plugin:@cypress/dev/tests" + ], + "env": { + "cypress/globals": true + }, + "rules": { + "no-console": "off", + "prefer-rest-params": "off" + } +} diff --git a/scripts/package.json b/scripts/package.json new file mode 100644 index 000000000000..4e477e482b9d --- /dev/null +++ b/scripts/package.json @@ -0,0 +1,6 @@ +{ + "name": "internal-scripts", + "scripts": { + "lint": "eslint --ext .js,.ts,.json, ." + } +} \ No newline at end of file