diff --git a/.github/actions/cargo-sweep/package.json b/.github/actions/cargo-sweep/package.json index 7b084d4a2b4587..93d8a86230c020 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 . --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 5c116337e9313c..c34a561b839cc2 100644 --- a/.github/actions/next-integration-stat/package.json +++ b/.github/actions/next-integration-stat/package.json @@ -2,7 +2,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 ." }, "devDependencies": { "@types/node": "^18.11.18", diff --git a/.github/actions/turbopack-bump/package.json b/.github/actions/turbopack-bump/package.json index 3a734f9a292179..c977c44f790be3 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 . --ignore-path=../../../.prettierignore" }, "dependencies": { "@actions/core": "^1.10.0", diff --git a/.prettierignore b/.prettierignore index 0964dfb8a7e786..26be87afcf6b9e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,6 @@ .next/ build/ -dist/ +dist node_modules/ target/ coverage/ diff --git a/benchmark/package.json b/benchmark/package.json index 9a9266042ebefb..19856a138ba9b7 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 . --ignore-path=../.prettierignore" }, "devDependencies": { "@types/node": "^16.11.49" diff --git a/cli/.prettierignore b/cli/.prettierignore new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/cli/package.json b/cli/package.json index 971eacafdb64b1..ad2b8136d90e9d 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 . --ignore-path=../.prettierignore" }, "devDependencies": { "copy-template-dir": "^1.4.0", diff --git a/crates/next-dev-tests/test-harness/package.json b/crates/next-dev-tests/test-harness/package.json new file mode 100644 index 00000000000000..b7b86fa03703f6 --- /dev/null +++ b/crates/next-dev-tests/test-harness/package.json @@ -0,0 +1,14 @@ +{ + "name": "@turbo/pack-test-harness", + "private": true, + "version": "0.0.1", + "main": "./harness.ts", + "dependencies": { + "expect": "^24.5.0", + "jest-circus": "^29.4.1", + "jest-circus-browser": "^1.0.7" + }, + "scripts": { + "lint:prettier": "prettier -c ." + } +} diff --git a/crates/next-dev-tests/tests/package.json b/crates/next-dev-tests/tests/package.json new file mode 100644 index 00000000000000..90c9301f3fd062 --- /dev/null +++ b/crates/next-dev-tests/tests/package.json @@ -0,0 +1,23 @@ +{ + "name": "next-dev-tests", + "private": true, + "devDependencies": { + "@babel/preset-typescript": "7.21.0", + "@turbo/pack-test-harness": "file:../test-harness", + "@types/jest": "29.4.0", + "@types/node": "^18.14.0", + "autoprefixer": "^10.4.13", + "babel-loader": "^9.1.2", + "loader-runner": "^4.3.0", + "next": "13.1.7-canary.28", + "postcss": "^8.4.20", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-test-renderer": "^18.2.0", + "styled-jsx": "^5.1.0", + "tailwindcss": "^3.2.4" + }, + "scripts": { + "lint:prettier": "prettier -c ." + } +} diff --git a/docs/package.json b/docs/package.json index 1ab06fa1bf0fcc..cb3160ce26b5e1 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 . --ignore-path=../.prettierignore" }, "author": "Jared Palmer", "license": "MPL-2.0", diff --git a/package.json b/package.json index 6fa7d33ee311f6..cb0e04d13ce508 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": "pnpm -- 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 1feff8d7cd4f88..399d7ae7f5416d 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 . --ignore-path=../../.prettierignore" }, "dependencies": { "async-retry": "^1.3.3", diff --git a/packages/eslint-config-turbo/package.json b/packages/eslint-config-turbo/package.json index fe20b33cb8a00b..26eb23e85b03f6 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 ." + }, "keywords": [ "turbo", "eslint", diff --git a/packages/eslint-plugin-turbo/package.json b/packages/eslint-plugin-turbo/package.json index 00870341d7804b..56c3135a7c3962 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 . --ignore-path=../../.prettierignore" }, "devDependencies": { "@types/eslint": "^8.4.5", diff --git a/packages/turbo-codemod/package.json b/packages/turbo-codemod/package.json index 28a660b7b5039d..7a1f1d727faac0 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 . --ignore-path=../../.prettierignore" }, "dependencies": { "axios": "0.27.2", diff --git a/packages/turbo-ignore/package.json b/packages/turbo-ignore/package.json index 7bfeeaf506407b..c706a577deb102 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 . --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 ff3f7f9d5e3e9b..8dc720fa83d9c6 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 ." }, "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 e2f0662f52b40c..bb28ef6ba4b335 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 . --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 0d37857c6965c3..16f289eaf3c872 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 ." }, "dependencies": { "mongoose": "^6.4.5", diff --git a/packages/turbo-types/package.json b/packages/turbo-types/package.json index 326cdbe5c74cb9..c9ee1055afbbaf 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 ." }, "devDependencies": { "@turbo/tsconfig": "workspace:^0.0.0" diff --git a/packages/turbo-utils/.prettierignore b/packages/turbo-utils/.prettierignore new file mode 100644 index 00000000000000..849ddff3b7ec91 --- /dev/null +++ b/packages/turbo-utils/.prettierignore @@ -0,0 +1 @@ +dist/ diff --git a/packages/turbo-utils/package.json b/packages/turbo-utils/package.json index fdaf5f207b3f0e..7a89a381426306 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 ." }, "devDependencies": { "@manypkg/find-root": "^1.1.0", diff --git a/packages/turbo-workspaces/package.json b/packages/turbo-workspaces/package.json index b7dbf5075eda36..e2fdbbca113efb 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 . --ignore-path=../../.prettierignore" }, "dependencies": { "chalk": "2.4.2", diff --git a/packages/webpack-nmt/package.json b/packages/webpack-nmt/package.json index 03f4b911b6183a..2f2dd822111181 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 . --ignore-path=../../.prettierignore" } } diff --git a/turbo.json b/turbo.json index 923b5e951f9f51..3a252ccf0b6fe0 100644 --- a/turbo.json +++ b/turbo.json @@ -6,14 +6,170 @@ "dependsOn": ["cli#build", "^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"]