Skip to content

Commit ceb882f

Browse files
tjenkinsonlennyburdetteshellscape
authored
chore(repo): Enforce prettier on CI (rollup#941)
* fix(dynamic-import-vars): allow ./${var}.suffix.js (rollup#834) Allow dynamically importing files in the same directory with an extra suffix before the extension. * enforce `prettier` is happy on CI * run prettier on more things in precommit and do not pass `--single-quote` to use the value in the config * run `pnpm run prettier` * remove redundant `--plugin` option because it will be loaded automatically given it's in the config * chore: add changelogs to docs lint Co-authored-by: Lenny Burdette <[email protected]> Co-authored-by: Andrew Powell <[email protected]> Co-authored-by: shellscape <[email protected]>
1 parent d2d568e commit ceb882f

File tree

13 files changed

+149
-143
lines changed

13 files changed

+149
-143
lines changed

.eslintrc.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ module.exports = {
1111
},
1212
overrides: [
1313
{
14-
'files': ['**/fixtures/**'],
15-
'rules': {
14+
files: ['**/fixtures/**'],
15+
rules: {
1616
'no-console': 'off',
1717
'import/extensions': 'off',
1818
'import/no-unresolved': 'off'
1919
}
2020
},
2121
{
22-
'files': ['**/test/**'],
23-
'rules': {
22+
files: ['**/test/**'],
23+
rules: {
2424
'import/extensions': 'off'
2525
}
2626
}
27-
],
27+
]
2828
};

.github/CODE_OF_CONDUCT.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo
88

99
Examples of behavior that contributes to creating a positive environment include:
1010

11-
* Using welcoming and inclusive language
12-
* Being respectful of differing viewpoints and experiences
13-
* Gracefully accepting constructive criticism
14-
* Focusing on what is best for the community
15-
* Showing empathy towards other community members
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy towards other community members
1616

1717
Examples of unacceptable behavior by participants include:
1818

19-
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20-
* Trolling, insulting/derogatory comments, and personal or political attacks
21-
* Public or private harassment
22-
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23-
* Other conduct which could reasonably be considered inappropriate in a professional setting
19+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
- Trolling, insulting/derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
- Other conduct which could reasonably be considered inappropriate in a professional setting
2424

2525
## Our Responsibilities
2626

.github/labels.json

+52-52
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
11
[
2-
{ "name": "💩 template incomplete", "color": "#4E342E" },
3-
{ "name": "💩 template removed", "color": "#4E342E" },
4-
5-
{ "name": "b¹ 🐞 code-splitting", "color": "#F44336" },
6-
{ "name": "b² 🐞 scope-hoisting", "color": "#F44336" },
7-
{ "name": "b³ 🐞 tree-shaking", "color": "#F44336" },
8-
9-
{ "name": "c¹ ⋅ discussion", "color": "#1976D2" },
10-
{ "name": "c² ⋅ feedback wanted", "color": "#F9A825" },
11-
{ "name": "c³ ⋅ PR welcome", "color": "#1B5E20" },
12-
{ "name": "c⁴ ⋅ need more info", "color": "#6A1B9A" },
13-
{ "name": "c⁵ ⋅ question", "color": "#C2185B" },
14-
{ "name": "c⁶ ⋅ request for comments", "color": "#BBDEFB" },
15-
16-
{ "name": "p¹ ⋅ browser", "color": "#B2DFDB" },
17-
{ "name": "p² ⋅ linux", "color": "#B2DFDB" },
18-
{ "name": "p³ ⋅ mac", "color": "#B2DFDB" },
19-
{ "name": "p⁴ ⋅ windows", "color": "#B2DFDB" },
20-
21-
{ "name": "pr¹ 🔧 chore", "color": "#D7CCC8" },
22-
{ "name": "pr² 🔧 docs", "color": "#D7CCC8" },
23-
{ "name": "pr³ 🔧 feature", "color": "#D7CCC8" },
24-
{ "name": "pr⁴ 🔧 fix", "color": "#D7CCC8" },
25-
{ "name": "pr⁵ 🔧 performance", "color": "#D7CCC8" },
26-
{ "name": "pr⁶ 🔧 refactor", "color": "#D7CCC8" },
27-
{ "name": "pr⁷ 🔧 style", "color": "#D7CCC8" },
28-
{ "name": "pr⁸ 🔧 test", "color": "#D7CCC8" },
29-
30-
{ "name": "s¹ 🔥🔥🔥 critical", "color": "#E53935" },
31-
{ "name": "s² 🔥🔥 important", "color": "#FB8C00" },
32-
{ "name": "s³ 🔥 nice to have", "color": "#FDD835" },
33-
{ "name": "s⁴ 💧 low", "color": "#039BE5" },
34-
{ "name": "s⁵ 💧💧 inconvenient", "color": "#c0e0f7" },
35-
36-
{ "name": "t¹ 🐞 bug", "color": "#F44336" },
37-
{ "name": "t² 📚 documentation", "color": "#FDD835" },
38-
{ "name": "t³ ✨ enhancement", "color": "#03a9f4" },
39-
{ "name": "t⁴ ⋅ regression", "color": "#0052cc" },
40-
{ "name": "t⁵ ⋅ todo", "color": "#311B92" },
41-
{ "name": "t⁶ ⋅ waiting on upstream", "color": "#0D47A1" },
42-
43-
{ "name": "v¹ ⋅ major", "color": "#CDDC39" },
44-
{ "name": "v² ⋅ minor", "color": "#FF9800" },
45-
{ "name": "v³ ⋅ minor (experimental)", "color": "#FFC107" },
46-
47-
{ "name": "x¹ ⋅ abandoned", "color": "#CFD8DC" },
48-
{ "name": "x² ⋅ could not reproduce", "color": "#CFD8DC" },
49-
{ "name": "x³ ⋅ duplicate", "color": "#CFD8DC" },
50-
{ "name": "x⁴ ⋅ hold", "color": "#CFD8DC" },
51-
{ "name": "x⁵ ⋅ in progress", "color": "#4CAF50" },
52-
{ "name": "x⁶ ⋅ invalid", "color": "#CFD8DC" },
53-
{ "name": "x⁷ ⋅ wontfix", "color": "#CFD8DC" }
2+
{ "name": "💩 template incomplete", "color": "#4E342E" },
3+
{ "name": "💩 template removed", "color": "#4E342E" },
4+
5+
{ "name": "b¹ 🐞 code-splitting", "color": "#F44336" },
6+
{ "name": "b² 🐞 scope-hoisting", "color": "#F44336" },
7+
{ "name": "b³ 🐞 tree-shaking", "color": "#F44336" },
8+
9+
{ "name": "c¹ ⋅ discussion", "color": "#1976D2" },
10+
{ "name": "c² ⋅ feedback wanted", "color": "#F9A825" },
11+
{ "name": "c³ ⋅ PR welcome", "color": "#1B5E20" },
12+
{ "name": "c⁴ ⋅ need more info", "color": "#6A1B9A" },
13+
{ "name": "c⁵ ⋅ question", "color": "#C2185B" },
14+
{ "name": "c⁶ ⋅ request for comments", "color": "#BBDEFB" },
15+
16+
{ "name": "p¹ ⋅ browser", "color": "#B2DFDB" },
17+
{ "name": "p² ⋅ linux", "color": "#B2DFDB" },
18+
{ "name": "p³ ⋅ mac", "color": "#B2DFDB" },
19+
{ "name": "p⁴ ⋅ windows", "color": "#B2DFDB" },
20+
21+
{ "name": "pr¹ 🔧 chore", "color": "#D7CCC8" },
22+
{ "name": "pr² 🔧 docs", "color": "#D7CCC8" },
23+
{ "name": "pr³ 🔧 feature", "color": "#D7CCC8" },
24+
{ "name": "pr⁴ 🔧 fix", "color": "#D7CCC8" },
25+
{ "name": "pr⁵ 🔧 performance", "color": "#D7CCC8" },
26+
{ "name": "pr⁶ 🔧 refactor", "color": "#D7CCC8" },
27+
{ "name": "pr⁷ 🔧 style", "color": "#D7CCC8" },
28+
{ "name": "pr⁸ 🔧 test", "color": "#D7CCC8" },
29+
30+
{ "name": "s¹ 🔥🔥🔥 critical", "color": "#E53935" },
31+
{ "name": "s² 🔥🔥 important", "color": "#FB8C00" },
32+
{ "name": "s³ 🔥 nice to have", "color": "#FDD835" },
33+
{ "name": "s⁴ 💧 low", "color": "#039BE5" },
34+
{ "name": "s⁵ 💧💧 inconvenient", "color": "#c0e0f7" },
35+
36+
{ "name": "t¹ 🐞 bug", "color": "#F44336" },
37+
{ "name": "t² 📚 documentation", "color": "#FDD835" },
38+
{ "name": "t³ ✨ enhancement", "color": "#03a9f4" },
39+
{ "name": "t⁴ ⋅ regression", "color": "#0052cc" },
40+
{ "name": "t⁵ ⋅ todo", "color": "#311B92" },
41+
{ "name": "t⁶ ⋅ waiting on upstream", "color": "#0D47A1" },
42+
43+
{ "name": "v¹ ⋅ major", "color": "#CDDC39" },
44+
{ "name": "v² ⋅ minor", "color": "#FF9800" },
45+
{ "name": "v³ ⋅ minor (experimental)", "color": "#FFC107" },
46+
47+
{ "name": "x¹ ⋅ abandoned", "color": "#CFD8DC" },
48+
{ "name": "x² ⋅ could not reproduce", "color": "#CFD8DC" },
49+
{ "name": "x³ ⋅ duplicate", "color": "#CFD8DC" },
50+
{ "name": "x⁴ ⋅ hold", "color": "#CFD8DC" },
51+
{ "name": "x⁵ ⋅ in progress", "color": "#4CAF50" },
52+
{ "name": "x⁶ ⋅ invalid", "color": "#CFD8DC" },
53+
{ "name": "x⁷ ⋅ wontfix", "color": "#CFD8DC" }
5454
]

.github/workflows/release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ jobs:
5050
- name: pnpm install
5151
run: pnpm install
5252

53+
- name: Prettier
54+
run: pnpm run prettier:check
55+
5356
- name: Build Packages
5457
run: pnpm build --recursive
5558

.github/workflows/validate.yml

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
- name: pnpm install
4343
run: pnpm install
4444

45+
- name: Prettier
46+
run: pnpm run prettier:check
47+
4548
# pnpm audit isn't as robust as it needs to be atm
4649
# - name: Audit Dependencies
4750
# run: pnpm security

.prettierignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
.github/PULL_REQUEST_TEMPLATE.md
44
packages/json/test/fixtures/garbage/*
55
packages/yaml/test/fixtures/**/*
6-
**/dist
6+
**/dist/
7+
**/fixtures/
8+
pnpm-lock.yaml

.vscode/launch.json

+15-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"type": "node",
9-
"request": "launch",
10-
"name": "Mocha Tests",
11-
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
12-
"args": [
13-
"-u",
14-
"tdd",
15-
"--timeout",
16-
"999999",
17-
"--colors"
18-
],
19-
"console": "integratedTerminal"
20-
}
21-
]
22-
}
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Mocha Tests",
11+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
12+
"args": ["-u", "tdd", "--timeout", "999999", "--colors"],
13+
"console": "integratedTerminal"
14+
}
15+
]
16+
}

codecov.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ coverage:
55
round: down
66
range: 70...100
77
status:
8-
project: "no"
9-
patch: "yes"
10-
comment: "off"
8+
project: 'no'
9+
patch: 'yes'
10+
comment: 'off'

package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
"scripts": {
55
"ci:coverage:submit": "node scripts/codecov",
66
"lint": "pnpm lint:docs && pnpm --no-bail lint:json && pnpm lint:package && pnpm lint:js",
7-
"lint:docs": "prettier --write .github/**/*.md **/README.md",
7+
"lint:docs": "prettier --write .github/**/*.md **/README.md **/CHANGELOG.md",
88
"lint:js": "eslint --cache packages scripts shared util --ext .js,.ts",
99
"lint:json": "prettier --write .github/**/*.yml **/tsconfig.json tsconfig.*.json pnpm-workspace.yaml",
10-
"lint:package": "prettier --write **/package.json --plugin=prettier-plugin-package",
10+
"lint:package": "prettier --write **/package.json",
1111
"plugin:release": "ts-node ./scripts/release.ts",
1212
"preinstall": "node scripts/disallow-npm.js",
13+
"prettier": "prettier --write .",
14+
"prettier:check": "prettier --check .",
1315
"security": "pnpm audit --audit-level=high"
1416
},
1517
"devDependencies": {
@@ -61,11 +63,8 @@
6163
"*.{ts,js}": [
6264
"eslint --fix"
6365
],
64-
"*.md": [
65-
"prettier --single-quote --write"
66-
],
67-
"*package.json": [
68-
"prettier --write --plugin=prettier-plugin-package"
66+
"*.{ts,js,json,yaml,yml,md}": [
67+
"prettier --write"
6968
]
7069
},
7170
"nyc": {

packages/dynamic-import-vars/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ _2020-08-13_
6969

7070
_2020-07-06_
7171

72-
- First release
72+
- First release

packages/html/recipes/external-files/ReadMe.md

+45-42
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,58 @@ import html from '@rollup/plugin-html';
77
import templateExternalFiles from '@rollup/plugin-html/recipes/external-files';
88
import postcss from 'rollup-plugin-postcss';
99

10-
export default [{
11-
input: [ 'demo/demo.ts' ],
12-
output: [ { file: 'dist/demo.js' } ],
13-
plugins: [
14-
postcss({
15-
extract: 'demo.css',
16-
minimize: false,
17-
use: ['sass'],
18-
extensions: ['.scss', '.css'],
19-
}),
20-
html({
21-
title: 'sdk demo page',
22-
publicPath: './',
23-
fileName: 'demo.html',
24-
attributes: { html: {lang: 'zh-cn'} },
25-
template: templateExternalFiles([
26-
{ type: 'js', file: 'example1.js', pos: 'before' },
27-
{ type: 'js', file: 'example2.js', pos: 'before' },
28-
{ type: 'js', file: 'example3.js' },
29-
{ type: 'js', file: 'example4.js', pos: 'before' },
30-
{ type: 'css', file: 'example1.css', pos: 'before' },
31-
{ type: 'css', file: 'example2.css', pos: 'before' },
32-
{ type: 'css', file: 'example3.css' },
33-
{ type: 'css', file: 'example4.css', pos: 'before' },
34-
]),
35-
}),
36-
],
37-
}];
10+
export default [
11+
{
12+
input: ['demo/demo.ts'],
13+
output: [{ file: 'dist/demo.js' }],
14+
plugins: [
15+
postcss({
16+
extract: 'demo.css',
17+
minimize: false,
18+
use: ['sass'],
19+
extensions: ['.scss', '.css']
20+
}),
21+
html({
22+
title: 'sdk demo page',
23+
publicPath: './',
24+
fileName: 'demo.html',
25+
attributes: { html: { lang: 'zh-cn' } },
26+
template: templateExternalFiles([
27+
{ type: 'js', file: 'example1.js', pos: 'before' },
28+
{ type: 'js', file: 'example2.js', pos: 'before' },
29+
{ type: 'js', file: 'example3.js' },
30+
{ type: 'js', file: 'example4.js', pos: 'before' },
31+
{ type: 'css', file: 'example1.css', pos: 'before' },
32+
{ type: 'css', file: 'example2.css', pos: 'before' },
33+
{ type: 'css', file: 'example3.css' },
34+
{ type: 'css', file: 'example4.css', pos: 'before' }
35+
])
36+
})
37+
]
38+
}
39+
];
3840
```
3941

4042
The content of the generated html file:
43+
4144
```html
42-
<!doctype html>
45+
<!DOCTYPE html>
4346
<html lang="zh-cn">
4447
<head>
45-
<meta charset="utf-8">
48+
<meta charset="utf-8" />
4649
<title>sdk demo page</title>
47-
<link href="./example1.css" rel="stylesheet">
48-
<link href="./example2.css" rel="stylesheet">
49-
<link href="./example4.css" rel="stylesheet">
50-
<link href="./demo.css" rel="stylesheet">
51-
<link href="./example3.css" rel="stylesheet">
52-
</head>
53-
<body>
54-
<script src="./example1.js"></script>
55-
<script src="./example2.js"></script>
56-
<script src="./example4.js"></script>
57-
<script src="./demo.js"></script>
58-
<script src="./example3.js"></script>
50+
<link href="./example1.css" rel="stylesheet" />
51+
<link href="./example2.css" rel="stylesheet" />
52+
<link href="./example4.css" rel="stylesheet" />
53+
<link href="./demo.css" rel="stylesheet" />
54+
<link href="./example3.css" rel="stylesheet" />
55+
</head>
56+
<body>
57+
<script src="./example1.js"></script>
58+
<script src="./example2.js"></script>
59+
<script src="./example4.js"></script>
60+
<script src="./demo.js"></script>
61+
<script src="./example3.js"></script>
5962
</body>
6063
</html>
6164
```

packages/replace/test/.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
rules: {
2+
"rules": {
33
"no-console": "off"
44
}
55
}

scripts/release.ts

+2
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ const pull = async (main: string) => {
126126

127127
await execa('git', ['checkout', '.npmrc']);
128128
await execa('git', ['pull', 'origin', main, '--no-edit']);
129+
const { stdout } = await execa('git', ['status']);
130+
console.log({ stdout });
129131
await execa('git', ['rebase']);
130132
};
131133

0 commit comments

Comments
 (0)