diff --git a/.github/actions/cargo-sweep/package.json b/.github/actions/cargo-sweep/package.json index 7b084d4a2b458..6d0c904490690 100644 --- a/.github/actions/cargo-sweep/package.json +++ b/.github/actions/cargo-sweep/package.json @@ -6,7 +6,8 @@ "build:main": "ncc build src/main.js -o dist/main --source-map", "build:post": "ncc build src/post.js -o dist/post --source-map", "prepare": "pnpm run build:main && pnpm run build:post", - "lint": "eslint . --ext js,jsx,ts,tsx" + "lint": "eslint . --ext js,jsx,ts,tsx", + "lint:prettier": "prettier -c . --cache --ignore-path=../../../.prettierignore" }, "dependencies": { "@actions/core": "^1.10.0", diff --git a/.github/actions/next-integration-stat/package.json b/.github/actions/next-integration-stat/package.json index 13145c6ea3e7c..7bf4599326866 100644 --- a/.github/actions/next-integration-stat/package.json +++ b/.github/actions/next-integration-stat/package.json @@ -3,7 +3,8 @@ "private": true, "main": "src/index.js", "scripts": { - "pack": "ncc -t -o . build src/index.ts" + "pack": "ncc -t -o . build src/index.ts", + "lint:prettier": "prettier -c . --cache --ignore-path=../../../.prettierignore" }, "devDependencies": { "@types/node": "^18.11.18", diff --git a/.github/actions/turbopack-bump/package.json b/.github/actions/turbopack-bump/package.json index 3a734f9a29217..648f83f357a59 100644 --- a/.github/actions/turbopack-bump/package.json +++ b/.github/actions/turbopack-bump/package.json @@ -4,7 +4,8 @@ "version": "1.0.0", "scripts": { "build": "ncc build src/index.ts -o dist --source-map --minify", - "prepare": "pnpm run build" + "prepare": "pnpm run build", + "lint:prettier": "prettier -c . --cache --ignore-path=../../../.prettierignore" }, "dependencies": { "@actions/core": "^1.10.0", diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b434d53b052da..d3171ff729a42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1167,9 +1167,11 @@ jobs: - name: Format check # This is the syntax for running the `//#lint` task specifically in turbo.json - # It runs the taplo check on taplo.toml, and prettier check across the whole repo. - # TODO: run prettier in individual workspaces instead of globally. - run: turbo run lint --filter=// + # It runs the taplo check on taplo.toml, and lint:prettier per workspace. + # Skip `cli` workspace for now. It has the lint task, but in Github CI + # we need to setup golangci-lint to make it work. Go linting is run in the "Go linting" + # job in this workflow. We can move that in here in the next step. + run: turbo run lint --filter=!cli final: name: Ok diff --git a/.prettierignore b/.prettierignore index 8a36bfdd1a555..6f6b7dcf3c9b4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,7 @@ .next/ build/ -dist/ +dist + node_modules/ target/ coverage/ @@ -9,6 +10,7 @@ generated/ pnpm-lock.yaml __generated__/ +/cli/dist-cross* /docs/public/schema.json /packages/eslint-plugin-turbo/__tests__/fixtures/ /packages/turbo-codemod/templates/ diff --git a/benchmark/package.json b/benchmark/package.json index 9a9266042ebef..4241f5999fe05 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -8,7 +8,8 @@ "ndjson": "^2.0.0" }, "scripts": { - "benchmark": "node -r esbuild-register src/index.ts" + "benchmark": "node -r esbuild-register src/index.ts", + "lint:prettier": "prettier -c . --cache --ignore-path=../.prettierignore" }, "devDependencies": { "@types/node": "^16.11.49" diff --git a/cli/package.json b/cli/package.json index 971eacafdb64b..738816a71649c 100644 --- a/cli/package.json +++ b/cli/package.json @@ -7,7 +7,8 @@ "build": "make", "test": "make test-go", "format": "make fmt-go", - "lint": "make lint-go" + "lint": "make lint-go", + "lint:prettier": "prettier -c . --cache --ignore-path=../.prettierignore" }, "devDependencies": { "copy-template-dir": "^1.4.0", diff --git a/docs/package.json b/docs/package.json index f4c80a8bcdb4d..b6ab8d835fbf6 100644 --- a/docs/package.json +++ b/docs/package.json @@ -9,7 +9,8 @@ "build": "next build ", "lint": "next lint", "rss": "node scripts/generate-rss.js", - "schema": "turbo-types-generate ./public/schema.json" + "schema": "turbo-types-generate ./public/schema.json", + "lint:prettier": "prettier -c . --cache --ignore-path=../.prettierignore" }, "author": "Jared Palmer", "license": "MPL-2.0", diff --git a/package.json b/package.json index 6fa7d33ee311f..f6eca44d6f284 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "build": "pnpm -- turbo run build --filter=docs", "build:turbo": "pnpm run --filter=cli build", "build:ts": "tsc -b tsconfig.project.json", - "check:prettier": "prettier -c .", + "lint:prettier": "turbo run lint:prettier", "check:toml": "taplo format --check", "format": "run-p format:prettier format:rs format:toml", "format:prettier": "prettier -w .", diff --git a/packages/create-turbo/package.json b/packages/create-turbo/package.json index 1cf7ac6f39806..751d334b2381c 100644 --- a/packages/create-turbo/package.json +++ b/packages/create-turbo/package.json @@ -19,7 +19,8 @@ "build": "tsup", "test": "jest", "lint": "eslint src/**/*.ts", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" }, "dependencies": { "chalk": "2.4.2", diff --git a/packages/eslint-config-turbo/package.json b/packages/eslint-config-turbo/package.json index 70f6ce6eacadf..51c308a94bd9c 100644 --- a/packages/eslint-config-turbo/package.json +++ b/packages/eslint-config-turbo/package.json @@ -10,6 +10,9 @@ "bugs": { "url": "https://github.com/vercel/turbo/issues" }, + "scripts": { + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" + }, "keywords": [ "turbo", "eslint", diff --git a/packages/eslint-plugin-turbo/package.json b/packages/eslint-plugin-turbo/package.json index 2f6b1cfc70155..5e50fba680053 100644 --- a/packages/eslint-plugin-turbo/package.json +++ b/packages/eslint-plugin-turbo/package.json @@ -27,7 +27,8 @@ "test": "jest", "build": "tsup", "check-types": "tsc --noEmit", - "lint": "eslint lib/**/*.ts" + "lint": "eslint lib/**/*.ts", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" }, "devDependencies": { "@types/eslint": "^8.4.5", diff --git a/packages/turbo-codemod/package.json b/packages/turbo-codemod/package.json index 9d854909c09f6..f2bbec3cbeab6 100644 --- a/packages/turbo-codemod/package.json +++ b/packages/turbo-codemod/package.json @@ -18,7 +18,8 @@ "test": "jest", "lint": "eslint src/**/*.ts", "check-types": "tsc --noEmit", - "add-transformer": "plop" + "add-transformer": "plop", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" }, "dependencies": { "axios": "0.27.2", diff --git a/packages/turbo-ignore/package.json b/packages/turbo-ignore/package.json index 7b31ab1ad6a4c..e027f4ea46e9e 100644 --- a/packages/turbo-ignore/package.json +++ b/packages/turbo-ignore/package.json @@ -23,7 +23,8 @@ "build": "tsup", "test": "jest", "lint": "eslint src/**/*.ts", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" }, "devDependencies": { "@types/jest": "^27.4.0", diff --git a/packages/turbo-test-utils/package.json b/packages/turbo-test-utils/package.json index ff3f7f9d5e3e9..7bba1c47aa3b2 100644 --- a/packages/turbo-test-utils/package.json +++ b/packages/turbo-test-utils/package.json @@ -18,7 +18,8 @@ }, "scripts": { "lint": "eslint src/**/*.ts", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettier-ignore" }, "devDependencies": { "@types/fs-extra": "^9.0.13", diff --git a/packages/turbo-tracing-next-plugin/package.json b/packages/turbo-tracing-next-plugin/package.json index e2f0662f52b40..4d250803e4902 100644 --- a/packages/turbo-tracing-next-plugin/package.json +++ b/packages/turbo-tracing-next-plugin/package.json @@ -20,6 +20,7 @@ "next": "^13.0.6" }, "scripts": { - "lint": "eslint src/**/*.ts" + "lint": "eslint src/**/*.ts", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" } } diff --git a/packages/turbo-tracing-next-plugin/test/with-mongodb-mongoose/package.json b/packages/turbo-tracing-next-plugin/test/with-mongodb-mongoose/package.json index 0d37857c6965c..fa0a95a58eb2b 100644 --- a/packages/turbo-tracing-next-plugin/test/with-mongodb-mongoose/package.json +++ b/packages/turbo-tracing-next-plugin/test/with-mongodb-mongoose/package.json @@ -4,7 +4,8 @@ "scripts": { "dev": "next dev", "build": "cross-env MONGODB_URI=localhost:27017 next build", - "start": "next start" + "start": "next start", + "lint:prettier": "prettier -c . --cache --ignore-path=../../../../.prettier-ignore" }, "dependencies": { "mongoose": "^6.4.5", diff --git a/packages/turbo-types/package.json b/packages/turbo-types/package.json index 326cdbe5c74cb..bad40b688b95d 100644 --- a/packages/turbo-types/package.json +++ b/packages/turbo-types/package.json @@ -11,7 +11,8 @@ "ts-json-schema-generator": "1.1.2" }, "scripts": { - "lint": "eslint src/**/*.ts" + "lint": "eslint src/**/*.ts", + "lint:prettier": "prettier -c . --cache" }, "devDependencies": { "@turbo/tsconfig": "workspace:^0.0.0" diff --git a/packages/turbo-utils/package.json b/packages/turbo-utils/package.json index ca08f0b6cbe1a..3f2f6bbaee58e 100644 --- a/packages/turbo-utils/package.json +++ b/packages/turbo-utils/package.json @@ -22,7 +22,8 @@ "build": "tsup", "test": "jest", "lint": "eslint src/**/*.ts", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" }, "devDependencies": { "@manypkg/find-root": "^1.1.0", diff --git a/packages/turbo-workspaces/package.json b/packages/turbo-workspaces/package.json index 85bbc7e11e30e..0eed152c13076 100644 --- a/packages/turbo-workspaces/package.json +++ b/packages/turbo-workspaces/package.json @@ -20,7 +20,8 @@ "dev": "tsup --watch", "test": "jest", "lint": "eslint src/**/*.ts", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" }, "dependencies": { "chalk": "2.4.2", diff --git a/packages/webpack-nmt/package.json b/packages/webpack-nmt/package.json index 03f4b911b6183..5216585978782 100644 --- a/packages/webpack-nmt/package.json +++ b/packages/webpack-nmt/package.json @@ -21,6 +21,7 @@ "webpack": "^5.75.0" }, "scripts": { - "lint": "eslint src/**/*.ts" + "lint": "eslint src/**/*.ts", + "lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" } } diff --git a/turbo.json b/turbo.json index 494a1595a90a9..38ba76ef23ac6 100644 --- a/turbo.json +++ b/turbo.json @@ -9,14 +9,170 @@ "dependsOn": ["^build"] }, - // lint tasks - "lint": {}, - // root lint task runs toml check and prettier - // TODO: run prettier in individual workspaces instead of globally. + // run prettier check before eslint + "lint": { + "dependsOn": ["lint:prettier"] + }, + + // root lint task runs toml check "//#lint": { - "dependsOn": ["//#check:toml", "//#check:prettier"] + "dependsOn": ["//#check:toml"] }, - "//#check:prettier": {}, + + // run lint:prettier in all workspaces + "lint:prettier": { + "inputs": [ + "**/*.4DForm", + "**/*.4DProject", + "**/*.JSON-tmLanguage", + "**/*._js", + "**/*.avsc", + "**/*.bones", + "**/*.cjs", + "**/*.code-snippets", + "**/*.component.html", + "**/*.css", + "**/*.cts", + "**/*.es", + "**/*.es6", + "**/*.frag", + "**/*.geojson", + "**/*.gltf", + "**/*.gql", + "**/*.graphql", + "**/*.graphqls", + "**/*.gs", + "**/*.handlebars", + "**/*.har", + "**/*.hbs", + "**/*.hta", + "**/*.htm", + "**/*.html", + "**/*.html.hl", + "**/*.ice", + "**/*.importmap", + "**/*.inc", + "**/*.jake", + "**/*.javascript", + "**/*.js", + "**/*.js.flow", + "**/*.jsb", + "**/*.jscad", + "**/*.jsfl", + "**/*.jslib", + "**/*.jsm", + "**/*.json", + "**/*.json5", + "**/*.jsonc", + "**/*.jspre", + "**/*.jss", + "**/*.jsx", + "**/*.less", + "**/*.livemd", + "**/*.markdown", + "**/*.mcmeta", + "**/*.md", + "**/*.mdown", + "**/*.mdwn", + "**/*.mdx", + "**/*.mir", + "**/*.mjml", + "**/*.mjs", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.mts", + "**/*.njs", + "**/*.pac", + "**/*.pcss", + "**/*.postcss", + "**/*.reek", + "**/*.ronn", + "**/*.rviz", + "**/*.scd", + "**/*.scss", + "**/*.sjs", + "**/*.ssjs", + "**/*.sublime-build", + "**/*.sublime-commands", + "**/*.sublime-completions", + "**/*.sublime-keymap", + "**/*.sublime-macro", + "**/*.sublime-menu", + "**/*.sublime-mousemap", + "**/*.sublime-project", + "**/*.sublime-settings", + "**/*.sublime-syntax", + "**/*.sublime-theme", + "**/*.sublime-workspace", + "**/*.sublime_metrics", + "**/*.sublime_session", + "**/*.syntax", + "**/*.tfstate", + "**/*.tfstate.backup", + "**/*.topojson", + "**/*.ts", + "**/*.tsx", + "**/*.vue", + "**/*.webapp", + "**/*.webmanifest", + "**/*.workbook", + "**/*.wxs", + "**/*.wxss", + "**/*.xht", + "**/*.xhtml", + "**/*.xsjs", + "**/*.xsjslib", + "**/*.yaml", + "**/*.yaml-tmlanguage", + "**/*.yaml.sed", + "**/*.yml", + "**/*.yml.mysql", + "**/*.yy", + "**/*.yyp", + "**/*.arcconfig", + "**/*.auto-changelog", + "**/*.babelrc", + "**/*.c8rc", + "**/*.clang-format", + "**/*.clang-tidy", + "**/*.devcontainer.json", + "**/*.eslintrc", + "**/*.eslintrc.json", + "**/*.gemrc", + "**/*.htmlhintrc", + "**/*.imgbotconfig", + "**/*.jscsrc", + "**/*.jshintrc", + "**/*.jslintrc", + "**/*.lintstagedrc", + "**/*.nycrc", + "**/*.prettierrc", + "**/*.stylelintrc", + "**/*.swcrc", + "**/*.tern-config", + "**/*.tern-project", + "**/*.watchmanconfig", + "**/*CITATION.cff", + "**/*Jakefile", + "**/*Pipfile.lock", + "**/*README", + "**/*api-extractor.json", + "**/*composer.json", + "**/*composer.lock", + "**/*contents.lr", + "**/*devcontainer.json", + "**/*glide.lock", + "**/*jsconfig.json", + "**/*language-configuration.json", + "**/*mcmod.info", + "**/*package-lock.json", + "**/*package.json", + "**/*tsconfig.json", + "**/*tslint.json" + ] + }, + "//#check:toml": {}, "check-types": { "dependsOn": ["^build"]