Skip to content

Commit acb01e3

Browse files
committed
docs(changeset): update package.json config to include config files
1 parent f29be9d commit acb01e3

File tree

12 files changed

+253
-249
lines changed

12 files changed

+253
-249
lines changed

.changeset/three-bags-drop.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'ko-lint-config': patch
3+
---
4+
5+
update package.json config to include config files

.prettierignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
*.json
44
/template/
55
/.github/
6-
pnpm-lock.yaml
6+
pnpm-lock.yaml
7+
**/build
8+
**/lib

.prettierrc.json .prettierrc

File renamed without changes.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
],
66
"scripts": {
77
"prepare": "husky install",
8-
"prettier:check": "prettier --check .",
9-
"prettier:write": "prettier --write .",
8+
"prettier:check": "prettier --config .prettierrc --ignore-path .gitignore --ignore-path .prettierignore --check .",
9+
"prettier:write": "prettier --config .prettierrc --ignore-path .gitignore --ignore-path .prettierignore --write .",
1010
"check": "pnpm prettier",
1111
"test": "pnpm test",
1212
"debug:ko": "pnpm --filter ./packages/ko debug",

packages/ko-lint-config/.eslintrc.js

+186-186
Large diffs are not rendered by default.
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module.exports = {
2-
semi: true, // 行末添加分号
3-
tabWidth: 4, // tab 缩进,默认 2
4-
printWidth: 80, // 换行长度,默认 80
5-
singleQuote: true, // 单引号
6-
useTabs: false, // 使用 tab 缩进,默认 false 使用空格
7-
bracketSpacing: true, // 对象中打印空格 默认 true
8-
arrowParens: 'always', // 箭头函数参数括号 可选 avoid(一个参数时省略) | always
9-
trailingComma: 'es5', // 尾逗号 可选 none | es5 | all
2+
semi: true, // 行末添加分号
3+
tabWidth: 4, // tab 缩进,默认 2
4+
printWidth: 80, // 换行长度,默认 80
5+
singleQuote: true, // 单引号
6+
useTabs: false, // 使用 tab 缩进,默认 false 使用空格
7+
bracketSpacing: true, // 对象中打印空格 默认 true
8+
arrowParens: 'always', // 箭头函数参数括号 可选 avoid(一个参数时省略) | always
9+
trailingComma: 'es5', // 尾逗号 可选 none | es5 | all
1010
};
+27-31
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
module.exports = {
2-
files: ['**/*.css', '**/*.scss'],
3-
customSyntax: require.resolve('postcss-scss'),
4-
extends: 'stylelint-config-standard',
5-
plugins: ['stylelint-order', 'stylelint-scss'],
6-
rules: {
7-
// null 为关闭规则
8-
indentation: 4, // 缩进4格
9-
'declaration-empty-line-before': 'never', // 第一条属性声明前不允许有空行
10-
'selector-class-pattern': '[a-zA-Z]+', // className 的大小写
11-
// 规则之前的空行
12-
'rule-empty-line-before': [
13-
'always',
14-
{
15-
except: [
16-
'inside-block',
17-
'first-nested',
18-
'after-single-line-comment',
19-
],
20-
},
21-
],
22-
'alpha-value-notation': 'number', // 小数显示数字(number)或百分数(percentage)
23-
'color-function-notation': 'legacy', // 颜色 rgba 等使用传统逗号隔开
24-
'color-hex-case': 'upper', // 颜色十六进制字符大写
25-
'selector-list-comma-newline-after': 'always-multi-line',
26-
'max-line-length': 300, // 最大宽度
27-
'font-family-no-missing-generic-family-keyword': null, // 是否必须包含通用字体
28-
'no-descending-specificity': null, // 选择器顺序
29-
'keyframes-name-pattern': null, // keyframes 推荐小写+连字符命名
30-
'no-empty-source': null, // 空文件
31-
'block-no-empty': null, // 空规则
32-
},
2+
files: ['**/*.css', '**/*.scss'],
3+
customSyntax: require.resolve('postcss-scss'),
4+
extends: 'stylelint-config-standard',
5+
plugins: ['stylelint-order', 'stylelint-scss'],
6+
rules: {
7+
// null 为关闭规则
8+
indentation: 4, // 缩进4格
9+
'declaration-empty-line-before': 'never', // 第一条属性声明前不允许有空行
10+
'selector-class-pattern': '[a-zA-Z]+', // className 的大小写
11+
// 规则之前的空行
12+
'rule-empty-line-before': [
13+
'always',
14+
{
15+
except: ['inside-block', 'first-nested', 'after-single-line-comment'],
16+
},
17+
],
18+
'alpha-value-notation': 'number', // 小数显示数字(number)或百分数(percentage)
19+
'color-function-notation': 'legacy', // 颜色 rgba 等使用传统逗号隔开
20+
'color-hex-case': 'upper', // 颜色十六进制字符大写
21+
'selector-list-comma-newline-after': 'always-multi-line',
22+
'max-line-length': 300, // 最大宽度
23+
'font-family-no-missing-generic-family-keyword': null, // 是否必须包含通用字体
24+
'no-descending-specificity': null, // 选择器顺序
25+
'keyframes-name-pattern': null, // keyframes 推荐小写+连字符命名
26+
'no-empty-source': null, // 空文件
27+
'block-no-empty': null, // 空规则
28+
},
3329
};

packages/ko-lint-config/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const eslint = require('eslint');
33
const stylelint = require('stylelint');
44

55
module.exports = {
6-
prettier,
7-
eslint,
8-
stylelint,
6+
prettier,
7+
eslint,
8+
stylelint,
99
};

packages/ko-lint-config/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "lint configs about eslint stylelint and prettier",
55
"main": "index.js",
66
"files": [
7+
"**/*",
78
"!test/**/*"
89
],
910
"typings": "index.d.ts",

packages/ko-lint-config/test/basic.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ const config = require('../');
33
const test = require('tape');
44

55
test('test basic properties of config', function (t) {
6-
t.ok(isObject(config.parserOptions));
7-
t.ok(isObject(config.env));
8-
t.ok(isObject(config.globals));
9-
t.ok(isObject(config.rules));
10-
t.end();
6+
t.ok(isObject(config.parserOptions));
7+
t.ok(isObject(config.env));
8+
t.ok(isObject(config.globals));
9+
t.ok(isObject(config.rules));
10+
t.end();
1111
});
1212

1313
function isObject(obj) {
14-
return typeof obj === 'object' && obj !== null;
14+
return typeof obj === 'object' && obj !== null;
1515
}

packages/ko-lint-config/test/validate-config.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ const { ESLint } = require('eslint');
33
const test = require('tape');
44

55
test('load config in eslint to validate all rule syntax is correct', async function (t) {
6-
const eslint = new ESLint();
7-
const code = 'const foo = 1\nconst bar = (val) => val + 1\nbar(foo)\n';
8-
const [lintResult] = await eslint.lintText(code);
9-
t.equal(lintResult.errorCount, 0);
10-
t.end();
6+
const eslint = new ESLint();
7+
const code = 'const foo = 1\nconst bar = (val) => val + 1\nbar(foo)\n';
8+
const [lintResult] = await eslint.lintText(code);
9+
t.equal(lintResult.errorCount, 0);
10+
t.end();
1111
});
1212

1313
test('ensure we allow top level await', async function (t) {
14-
const eslint = new ESLint();
15-
const code =
16-
'const foo = await 1\nconst bar = (val) => val + 2\nawait bar(foo)\n';
17-
const [lintResult] = await eslint.lintText(code);
18-
t.equal(lintResult.errorCount, 0);
19-
t.end();
14+
const eslint = new ESLint();
15+
const code =
16+
'const foo = await 1\nconst bar = (val) => val + 2\nawait bar(foo)\n';
17+
const [lintResult] = await eslint.lintText(code);
18+
t.equal(lintResult.errorCount, 0);
19+
t.end();
2020
});

website/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/node_modules
33

44
# Production
5-
/build
5+
**/build
66

77
# Generated files
88
.docusaurus

0 commit comments

Comments
 (0)