Skip to content

Commit

Permalink
chore(repo): Enforce prettier on CI (#941)
Browse files Browse the repository at this point in the history
* fix(dynamic-import-vars): allow ./${var}.suffix.js (#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 <lennyburdette@gmail.com>
Co-authored-by: Andrew Powell <shellscape@users.noreply.github.com>
Co-authored-by: shellscape <andrew@shellscape.org>
  • Loading branch information
4 people authored Jul 15, 2021
1 parent d2d568e commit ceb882f
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 143 deletions.
10 changes: 5 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ module.exports = {
},
overrides: [
{
'files': ['**/fixtures/**'],
'rules': {
files: ['**/fixtures/**'],
rules: {
'no-console': 'off',
'import/extensions': 'off',
'import/no-unresolved': 'off'
}
},
{
'files': ['**/test/**'],
'rules': {
files: ['**/test/**'],
rules: {
'import/extensions': 'off'
}
}
],
]
};
20 changes: 10 additions & 10 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

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

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

Examples of unacceptable behavior by participants include:

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

## Our Responsibilities

Expand Down
104 changes: 52 additions & 52 deletions .github/labels.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
[
{ "name": "💩 template incomplete", "color": "#4E342E" },
{ "name": "💩 template removed", "color": "#4E342E" },

{ "name": "b¹ 🐞 code-splitting", "color": "#F44336" },
{ "name": "b² 🐞 scope-hoisting", "color": "#F44336" },
{ "name": "b³ 🐞 tree-shaking", "color": "#F44336" },

{ "name": "c¹ ⋅ discussion", "color": "#1976D2" },
{ "name": "c² ⋅ feedback wanted", "color": "#F9A825" },
{ "name": "c³ ⋅ PR welcome", "color": "#1B5E20" },
{ "name": "c⁴ ⋅ need more info", "color": "#6A1B9A" },
{ "name": "c⁵ ⋅ question", "color": "#C2185B" },
{ "name": "c⁶ ⋅ request for comments", "color": "#BBDEFB" },

{ "name": "p¹ ⋅ browser", "color": "#B2DFDB" },
{ "name": "p² ⋅ linux", "color": "#B2DFDB" },
{ "name": "p³ ⋅ mac", "color": "#B2DFDB" },
{ "name": "p⁴ ⋅ windows", "color": "#B2DFDB" },

{ "name": "pr¹ 🔧 chore", "color": "#D7CCC8" },
{ "name": "pr² 🔧 docs", "color": "#D7CCC8" },
{ "name": "pr³ 🔧 feature", "color": "#D7CCC8" },
{ "name": "pr⁴ 🔧 fix", "color": "#D7CCC8" },
{ "name": "pr⁵ 🔧 performance", "color": "#D7CCC8" },
{ "name": "pr⁶ 🔧 refactor", "color": "#D7CCC8" },
{ "name": "pr⁷ 🔧 style", "color": "#D7CCC8" },
{ "name": "pr⁸ 🔧 test", "color": "#D7CCC8" },

{ "name": "s¹ 🔥🔥🔥 critical", "color": "#E53935" },
{ "name": "s² 🔥🔥 important", "color": "#FB8C00" },
{ "name": "s³ 🔥 nice to have", "color": "#FDD835" },
{ "name": "s⁴ 💧 low", "color": "#039BE5" },
{ "name": "s⁵ 💧💧 inconvenient", "color": "#c0e0f7" },

{ "name": "t¹ 🐞 bug", "color": "#F44336" },
{ "name": "t² 📚 documentation", "color": "#FDD835" },
{ "name": "t³ ✨ enhancement", "color": "#03a9f4" },
{ "name": "t⁴ ⋅ regression", "color": "#0052cc" },
{ "name": "t⁵ ⋅ todo", "color": "#311B92" },
{ "name": "t⁶ ⋅ waiting on upstream", "color": "#0D47A1" },

{ "name": "v¹ ⋅ major", "color": "#CDDC39" },
{ "name": "v² ⋅ minor", "color": "#FF9800" },
{ "name": "v³ ⋅ minor (experimental)", "color": "#FFC107" },

{ "name": "x¹ ⋅ abandoned", "color": "#CFD8DC" },
{ "name": "x² ⋅ could not reproduce", "color": "#CFD8DC" },
{ "name": "x³ ⋅ duplicate", "color": "#CFD8DC" },
{ "name": "x⁴ ⋅ hold", "color": "#CFD8DC" },
{ "name": "x⁵ ⋅ in progress", "color": "#4CAF50" },
{ "name": "x⁶ ⋅ invalid", "color": "#CFD8DC" },
{ "name": "x⁷ ⋅ wontfix", "color": "#CFD8DC" }
{ "name": "💩 template incomplete", "color": "#4E342E" },
{ "name": "💩 template removed", "color": "#4E342E" },

{ "name": "b¹ 🐞 code-splitting", "color": "#F44336" },
{ "name": "b² 🐞 scope-hoisting", "color": "#F44336" },
{ "name": "b³ 🐞 tree-shaking", "color": "#F44336" },

{ "name": "c¹ ⋅ discussion", "color": "#1976D2" },
{ "name": "c² ⋅ feedback wanted", "color": "#F9A825" },
{ "name": "c³ ⋅ PR welcome", "color": "#1B5E20" },
{ "name": "c⁴ ⋅ need more info", "color": "#6A1B9A" },
{ "name": "c⁵ ⋅ question", "color": "#C2185B" },
{ "name": "c⁶ ⋅ request for comments", "color": "#BBDEFB" },

{ "name": "p¹ ⋅ browser", "color": "#B2DFDB" },
{ "name": "p² ⋅ linux", "color": "#B2DFDB" },
{ "name": "p³ ⋅ mac", "color": "#B2DFDB" },
{ "name": "p⁴ ⋅ windows", "color": "#B2DFDB" },

{ "name": "pr¹ 🔧 chore", "color": "#D7CCC8" },
{ "name": "pr² 🔧 docs", "color": "#D7CCC8" },
{ "name": "pr³ 🔧 feature", "color": "#D7CCC8" },
{ "name": "pr⁴ 🔧 fix", "color": "#D7CCC8" },
{ "name": "pr⁵ 🔧 performance", "color": "#D7CCC8" },
{ "name": "pr⁶ 🔧 refactor", "color": "#D7CCC8" },
{ "name": "pr⁷ 🔧 style", "color": "#D7CCC8" },
{ "name": "pr⁸ 🔧 test", "color": "#D7CCC8" },

{ "name": "s¹ 🔥🔥🔥 critical", "color": "#E53935" },
{ "name": "s² 🔥🔥 important", "color": "#FB8C00" },
{ "name": "s³ 🔥 nice to have", "color": "#FDD835" },
{ "name": "s⁴ 💧 low", "color": "#039BE5" },
{ "name": "s⁵ 💧💧 inconvenient", "color": "#c0e0f7" },

{ "name": "t¹ 🐞 bug", "color": "#F44336" },
{ "name": "t² 📚 documentation", "color": "#FDD835" },
{ "name": "t³ ✨ enhancement", "color": "#03a9f4" },
{ "name": "t⁴ ⋅ regression", "color": "#0052cc" },
{ "name": "t⁵ ⋅ todo", "color": "#311B92" },
{ "name": "t⁶ ⋅ waiting on upstream", "color": "#0D47A1" },

{ "name": "v¹ ⋅ major", "color": "#CDDC39" },
{ "name": "v² ⋅ minor", "color": "#FF9800" },
{ "name": "v³ ⋅ minor (experimental)", "color": "#FFC107" },

{ "name": "x¹ ⋅ abandoned", "color": "#CFD8DC" },
{ "name": "x² ⋅ could not reproduce", "color": "#CFD8DC" },
{ "name": "x³ ⋅ duplicate", "color": "#CFD8DC" },
{ "name": "x⁴ ⋅ hold", "color": "#CFD8DC" },
{ "name": "x⁵ ⋅ in progress", "color": "#4CAF50" },
{ "name": "x⁶ ⋅ invalid", "color": "#CFD8DC" },
{ "name": "x⁷ ⋅ wontfix", "color": "#CFD8DC" }
]
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
- name: pnpm install
run: pnpm install

- name: Prettier
run: pnpm run prettier:check

- name: Build Packages
run: pnpm build --recursive

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
- name: pnpm install
run: pnpm install

- name: Prettier
run: pnpm run prettier:check

# pnpm audit isn't as robust as it needs to be atm
# - name: Audit Dependencies
# run: pnpm security
Expand Down
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
.github/PULL_REQUEST_TEMPLATE.md
packages/json/test/fixtures/garbage/*
packages/yaml/test/fixtures/**/*
**/dist
**/dist/
**/fixtures/
pnpm-lock.yaml
36 changes: 15 additions & 21 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors"
],
"console": "integratedTerminal"
}
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": ["-u", "tdd", "--timeout", "999999", "--colors"],
"console": "integratedTerminal"
}
]
}
6 changes: 3 additions & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ coverage:
round: down
range: 70...100
status:
project: "no"
patch: "yes"
comment: "off"
project: 'no'
patch: 'yes'
comment: 'off'
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
"scripts": {
"ci:coverage:submit": "node scripts/codecov",
"lint": "pnpm lint:docs && pnpm --no-bail lint:json && pnpm lint:package && pnpm lint:js",
"lint:docs": "prettier --write .github/**/*.md **/README.md",
"lint:docs": "prettier --write .github/**/*.md **/README.md **/CHANGELOG.md",
"lint:js": "eslint --cache packages scripts shared util --ext .js,.ts",
"lint:json": "prettier --write .github/**/*.yml **/tsconfig.json tsconfig.*.json pnpm-workspace.yaml",
"lint:package": "prettier --write **/package.json --plugin=prettier-plugin-package",
"lint:package": "prettier --write **/package.json",
"plugin:release": "ts-node ./scripts/release.ts",
"preinstall": "node scripts/disallow-npm.js",
"prettier": "prettier --write .",
"prettier:check": "prettier --check .",
"security": "pnpm audit --audit-level=high"
},
"devDependencies": {
Expand Down Expand Up @@ -61,11 +63,8 @@
"*.{ts,js}": [
"eslint --fix"
],
"*.md": [
"prettier --single-quote --write"
],
"*package.json": [
"prettier --write --plugin=prettier-plugin-package"
"*.{ts,js,json,yaml,yml,md}": [
"prettier --write"
]
},
"nyc": {
Expand Down
2 changes: 1 addition & 1 deletion packages/dynamic-import-vars/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ _2020-08-13_

_2020-07-06_

- First release
- First release
87 changes: 45 additions & 42 deletions packages/html/recipes/external-files/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,58 @@ import html from '@rollup/plugin-html';
import templateExternalFiles from '@rollup/plugin-html/recipes/external-files';
import postcss from 'rollup-plugin-postcss';

export default [{
input: [ 'demo/demo.ts' ],
output: [ { file: 'dist/demo.js' } ],
plugins: [
postcss({
extract: 'demo.css',
minimize: false,
use: ['sass'],
extensions: ['.scss', '.css'],
}),
html({
title: 'sdk demo page',
publicPath: './',
fileName: 'demo.html',
attributes: { html: {lang: 'zh-cn'} },
template: templateExternalFiles([
{ type: 'js', file: 'example1.js', pos: 'before' },
{ type: 'js', file: 'example2.js', pos: 'before' },
{ type: 'js', file: 'example3.js' },
{ type: 'js', file: 'example4.js', pos: 'before' },
{ type: 'css', file: 'example1.css', pos: 'before' },
{ type: 'css', file: 'example2.css', pos: 'before' },
{ type: 'css', file: 'example3.css' },
{ type: 'css', file: 'example4.css', pos: 'before' },
]),
}),
],
}];
export default [
{
input: ['demo/demo.ts'],
output: [{ file: 'dist/demo.js' }],
plugins: [
postcss({
extract: 'demo.css',
minimize: false,
use: ['sass'],
extensions: ['.scss', '.css']
}),
html({
title: 'sdk demo page',
publicPath: './',
fileName: 'demo.html',
attributes: { html: { lang: 'zh-cn' } },
template: templateExternalFiles([
{ type: 'js', file: 'example1.js', pos: 'before' },
{ type: 'js', file: 'example2.js', pos: 'before' },
{ type: 'js', file: 'example3.js' },
{ type: 'js', file: 'example4.js', pos: 'before' },
{ type: 'css', file: 'example1.css', pos: 'before' },
{ type: 'css', file: 'example2.css', pos: 'before' },
{ type: 'css', file: 'example3.css' },
{ type: 'css', file: 'example4.css', pos: 'before' }
])
})
]
}
];
```

The content of the generated html file:

```html
<!doctype html>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta charset="utf-8" />
<title>sdk demo page</title>
<link href="./example1.css" rel="stylesheet">
<link href="./example2.css" rel="stylesheet">
<link href="./example4.css" rel="stylesheet">
<link href="./demo.css" rel="stylesheet">
<link href="./example3.css" rel="stylesheet">
</head>
<body>
<script src="./example1.js"></script>
<script src="./example2.js"></script>
<script src="./example4.js"></script>
<script src="./demo.js"></script>
<script src="./example3.js"></script>
<link href="./example1.css" rel="stylesheet" />
<link href="./example2.css" rel="stylesheet" />
<link href="./example4.css" rel="stylesheet" />
<link href="./demo.css" rel="stylesheet" />
<link href="./example3.css" rel="stylesheet" />
</head>
<body>
<script src="./example1.js"></script>
<script src="./example2.js"></script>
<script src="./example4.js"></script>
<script src="./demo.js"></script>
<script src="./example3.js"></script>
</body>
</html>
```
2 changes: 1 addition & 1 deletion packages/replace/test/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
rules: {
"rules": {
"no-console": "off"
}
}
2 changes: 2 additions & 0 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ const pull = async (main: string) => {

await execa('git', ['checkout', '.npmrc']);
await execa('git', ['pull', 'origin', main, '--no-edit']);
const { stdout } = await execa('git', ['status']);
console.log({ stdout });
await execa('git', ['rebase']);
};

Expand Down

0 comments on commit ceb882f

Please sign in to comment.