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 a89212918cb28..c756a9af6bc48 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1221,9 +1221,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 7c133e72e295d..91df2869e0e62 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 710e8089629d5..18117e268d111 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 b5130846d43f4..f58e34d32c960 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 e6b35aceb8c00..a5f444b30fb77 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 6857d94838b8c..cd070778f6d9c 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 bb33dabfb7553..ddb13e4505765 100644 --- a/packages/turbo-types/package.json +++ b/packages/turbo-types/package.json @@ -18,7 +18,8 @@ "turbo-types-generate": "./src/scripts/codegen.js" }, "scripts": { - "lint": "eslint src/**/*.ts" + "lint": "eslint src/**/*.ts", + "lint:prettier": "prettier -c . --cache" }, "dependencies": { "ts-json-schema-generator": "1.1.2" 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 038a0e020f4f3..331c46961b423 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"]