Skip to content

Commit 4cb0383

Browse files
committed
fix: add prettier support, mostly via eslint
1 parent f1c09a7 commit 4cb0383

File tree

16 files changed

+299
-977
lines changed

16 files changed

+299
-977
lines changed

.prettierignore

+23-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,26 @@ common/temp/
7171
# Prettier-specific overrides
7272
#-------------------------------------------------------------------------------------------------------------------
7373

74-
/*/*/CHANGELOG.md
75-
/common/changes
76-
/common/scripts
74+
# Rush files
75+
common/changes/
76+
common/scripts/
77+
common/config/
78+
CHANGELOG.*
79+
80+
# Package manager files
81+
pnpm-lock.yaml
82+
yarn.lock
83+
package-lock.json
84+
shrinkwrap.json
85+
86+
# Build outputs
87+
dist
88+
lib
89+
90+
# Prettier reformats code blocks inside Markdown, which affects rendered output
91+
*.md
92+
93+
# Projects will manage their own prettier implementations as part of testing
94+
commands/
95+
internal/
96+
presets/

.prettierrc.js

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,16 +1 @@
1-
// Documentation for this file: https://prettier.io/docs/en/configuration.html
2-
module.exports = {
3-
// We use a larger print width because Prettier's word-wrapping seems to be tuned
4-
// for plain JavaScript without type annotations
5-
printWidth: 110,
6-
7-
// Use .gitattributes to manage newlines
8-
endOfLine: 'auto',
9-
10-
// Use single quotes instead of double quotes
11-
singleQuote: true,
12-
13-
// For ES5, trailing commas cannot be used in function parameters; it is counterintuitive
14-
// to use them for arrays only
15-
// trailingComma: "none"
16-
};
1+
module.exports = require('./presets/prettier');

commands/bootstrap/.npmignore

-3
This file was deleted.

commands/bootstrap/.prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@mscharley/prettier-config"

commands/bootstrap/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
},
88
"scripts": {
99
"build": "tsc",
10+
"precommit": "eslint --ext .js,.jsx,.ts,.tsx --fix src __tests__",
1011
"test": "npm run test:lint && npm run test:jest",
1112
"test:lint": "eslint --ext .js,.jsx,.ts,.tsx src __tests__",
1213
"test:jest": "jest 2>&1"
@@ -29,14 +30,12 @@
2930
"@babel/preset-env": "~7.9.5",
3031
"@babel/preset-typescript": "~7.9.0",
3132
"@mscharley/eslint-config": "workspace:~1.2.9",
33+
"@mscharley/prettier-config": "workspace:~1.0.0",
3234
"@types/jest": "~25.2.1",
3335
"@types/node": "~13.13.2",
34-
"@typescript-eslint/parser": "~4.16.1",
35-
"@typescript-eslint/eslint-plugin": "~4.16.1",
3636
"babel-jest": "~25.4.0",
3737
"bufferutil": "~4.0.1",
3838
"canvas": "~2.6.1",
39-
"eslint": "~7.21.0",
4039
"jest": "~25.4.0",
4140
"typescript": "~4.2.2",
4241
"utf-8-validate": "~5.0.2"

common/config/rush/command-line.json

+7-28
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@
111111
"summary": "Run tests for all packages.",
112112
"enableParallelism": false
113113
},
114+
{
115+
"commandKind": "bulk",
116+
"name": "precommit",
117+
"summary": "Run all precommit tests.",
118+
"enableParallelism": true,
119+
"ignoreDependencyOrder": true
120+
},
114121

115122
// {
116123
// /**
@@ -140,13 +147,6 @@
140147
"autoinstallerName": "rush-prettier",
141148
"shellCommand": "pretty-quick --staged"
142149
},
143-
{
144-
"name": "prettier",
145-
"commandKind": "global",
146-
"summary": "Basic access to prettier globally.",
147-
"autoinstallerName": "rush-prettier",
148-
"shellCommand": "prettier ."
149-
},
150150
{
151151
"name": "commitlint",
152152
"commandKind": "global",
@@ -282,27 +282,6 @@
282282
// ]
283283
// }
284284

285-
{
286-
"parameterKind": "flag",
287-
"longName": "--check",
288-
"shortName": "-c",
289-
"description": "Check if the given files are formatted.",
290-
"associatedCommands": ["prettier"]
291-
},
292-
{
293-
"parameterKind": "flag",
294-
"longName": "--list-different",
295-
"shortName": "-l",
296-
"description": "Print the names of files that are different from Prettier's formatting.",
297-
"associatedCommands": ["prettier"]
298-
},
299-
{
300-
"parameterKind": "flag",
301-
"longName": "--write",
302-
"shortName": "-w",
303-
"description": "Edit files in-place. (Beware!)",
304-
"associatedCommands": ["prettier"]
305-
},
306285
{
307286
"parameterKind": "string",
308287
"longName": "--edit",

0 commit comments

Comments
 (0)