mirror of
https://github.com/facebook/react.git
synced 2026-02-21 19:31:52 +00:00
[prettier] Combine compiler and runtime configs
Merges the existing config to the root one so we can have a single
configuration file. I've tried to keep the compiler config as much as
possible in this PR so that no formatting changes occur.
ghstack-source-id: 8bbfc9f269
Pull Request resolved: https://github.com/facebook/react/pull/30021
This commit is contained in:
19
.github/workflows/compiler-typescript.yml
vendored
19
.github/workflows/compiler-typescript.yml
vendored
@@ -23,25 +23,6 @@ jobs:
|
||||
- id: set-matrix
|
||||
run: echo "matrix=$(find packages -mindepth 1 -maxdepth 1 -type d | sed 's!packages/!!g' | tr '\n' ',' | sed s/.$// | jq -Rsc '. / "," - [""]')" >> $GITHUB_OUTPUT
|
||||
|
||||
# Hardcoded to improve parallelism for babel-plugin-react-compiler
|
||||
prettier:
|
||||
name: Run prettier
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "yarn"
|
||||
cache-dependency-path: compiler/yarn.lock
|
||||
- name: Restore cached node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('compiler/**/yarn.lock') }}
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn prettier:ci
|
||||
|
||||
# Hardcoded to improve parallelism
|
||||
lint:
|
||||
name: Lint babel-plugin-react-compiler
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# react runtime
|
||||
build
|
||||
|
||||
packages/react-devtools-core/dist
|
||||
@@ -13,3 +14,26 @@ packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/
|
||||
packages/react-devtools-shell/dist
|
||||
packages/react-devtools-timeline/dist
|
||||
packages/react-devtools-timeline/static
|
||||
|
||||
# react compiler
|
||||
compiler/**/dist
|
||||
compiler/**/__tests__/fixtures/**/*.expect.md
|
||||
compiler/**/__tests__/fixtures/**/*.flow.js
|
||||
compiler/**/.next
|
||||
|
||||
compiler/crates
|
||||
compiler/apps/playground/public
|
||||
|
||||
compiler/**/LICENSE
|
||||
compiler/.*
|
||||
compiler/*.md*
|
||||
compiler/*.json
|
||||
compiler/*.css
|
||||
compiler/*.webmanifest
|
||||
compiler/*.map
|
||||
compiler/*.sh
|
||||
compiler/*.txt
|
||||
compiler/*.ico
|
||||
compiler/*.svg
|
||||
compiler/*.lock
|
||||
compiler/*.toml
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
compilerPaths,
|
||||
esNextPaths,
|
||||
typescriptPaths,
|
||||
} = require('./scripts/shared/pathsByLanguageVersion');
|
||||
@@ -33,5 +34,19 @@ module.exports = {
|
||||
parser: 'typescript',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: compilerPaths,
|
||||
options: {
|
||||
requirePragma: false,
|
||||
parser: 'babel-ts',
|
||||
semi: true,
|
||||
singleQuote: false,
|
||||
trailingComma: 'es5',
|
||||
bracketSpacing: true,
|
||||
bracketSameLine: false,
|
||||
printWidth: 80,
|
||||
arrowParens: 'always',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
**/dist
|
||||
**/__tests__/fixtures/**/*.expect.md
|
||||
**/__tests__/fixtures/**/*.flow.js
|
||||
**/.next
|
||||
|
||||
crates
|
||||
apps/playground/public
|
||||
|
||||
**/LICENSE
|
||||
.*
|
||||
*.md*
|
||||
*.json
|
||||
*.css
|
||||
*.webmanifest
|
||||
*.map
|
||||
*.sh
|
||||
*.txt
|
||||
*.ico
|
||||
*.svg
|
||||
*.lock
|
||||
*.toml
|
||||
@@ -1,9 +0,0 @@
|
||||
const config = {
|
||||
requirePragma: false,
|
||||
parser: "babel-ts",
|
||||
semi: true,
|
||||
singleQuote: false,
|
||||
trailingComma: "es5"
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
@@ -22,8 +22,6 @@
|
||||
"build": "yarn workspaces run build",
|
||||
"dev": "concurrently --kill-others -n compiler,runtime,playground \"yarn workspace babel-plugin-react-compiler run build --watch\" \"yarn workspace react-compiler-runtime run build --watch\" \"wait-on packages/babel-plugin-react-compiler/dist/index.js && yarn workspace playground run dev\"",
|
||||
"test": "yarn workspaces run test",
|
||||
"prettier:write": "prettier --write . --log-level=warn",
|
||||
"prettier:ci": "prettier --check . --log-level=warn",
|
||||
"snap": "yarn workspace babel-plugin-react-compiler run snap",
|
||||
"snap:build": "yarn workspace snap run build",
|
||||
"postinstall": "perl -p -i -e 's/react\\.element/react.transitional.element/' packages/snap/node_modules/fbt/lib/FbtReactUtil.js && perl -p -i -e 's/didWarnAboutUsingAct = false;/didWarnAboutUsingAct = true;/' packages/babel-plugin-react-compiler/node_modules/react-dom/cjs/react-dom-test-utils.development.js",
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
"flow-ci": "node ./scripts/tasks/flow-ci.js",
|
||||
"prettier": "node ./scripts/prettier/index.js write-changed",
|
||||
"prettier-all": "node ./scripts/prettier/index.js write",
|
||||
"prettier-check": "node ./scripts/prettier/index.js",
|
||||
"version-check": "node ./scripts/tasks/version-check.js",
|
||||
"publish-prereleases": "node ./scripts/release/publish-using-ci-workflow.js",
|
||||
"download-build": "node ./scripts/release/download-experimental-build.js",
|
||||
|
||||
@@ -51,11 +51,14 @@ const ignoredPathsListedInPrettierIgnoreInGlobFormat =
|
||||
});
|
||||
|
||||
const files = glob
|
||||
.sync('**/*.js', {
|
||||
.sync('**/*.{js,jsx,ts,tsx}', {
|
||||
ignore: [
|
||||
'**/*.d.ts',
|
||||
'**/node_modules/**',
|
||||
'**/cjs/**',
|
||||
'compiler/**',
|
||||
'**/dist/**',
|
||||
'**/__snapshots__/**',
|
||||
'packages/**/*.ts', // runtime prettier uses Flow parser
|
||||
...ignoredPathsListedInPrettierIgnoreInGlobFormat,
|
||||
],
|
||||
})
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const compilerPaths = ['compiler/**'];
|
||||
|
||||
// Files that are transformed and can use ES6/Flow/JSX.
|
||||
const esNextPaths = [
|
||||
// Internal forwarding modules
|
||||
@@ -28,6 +30,7 @@ const es5Paths = ['packages/*/npm/**/*.js'];
|
||||
const typescriptPaths = ['packages/**/*.d.ts'];
|
||||
|
||||
module.exports = {
|
||||
compilerPaths,
|
||||
esNextPaths,
|
||||
es5Paths,
|
||||
typescriptPaths,
|
||||
|
||||
Reference in New Issue
Block a user