@d-zero/lint-staged-config 6.0.0-alpha.2 → 6.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/commands.js +4 -1
- package/dist/default-mapping.js +19 -19
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -4
- package/dist/types.d.ts +1 -1
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -15,6 +15,20 @@ import lintStagedConfigGenerator from '@d-zero/lint-staged-config';
|
|
|
15
15
|
export default lintStagedConfigGenerator();
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
### Markuplint
|
|
19
|
+
|
|
20
|
+
Markuplint v5 を前提に、`markuplint`は`--no-allow-warnings`付きで実行し、警告(`warning`)でもコミットを止めます。コマンドの文字列は変更できないため、警告で止めたくない場合は、該当するルールの severity をMarkuplintの設定で変えてください。
|
|
21
|
+
|
|
22
|
+
Markuplintは、パーサーが設定されていない拡張子のファイルを**エラーにせず黙って飛ばします**。既定のマッピングは`.pug`/`.jsx`/`.tsx`/`.vue`/`.svelte`/`.astro`も`markuplint`に渡すため、これらを検査するにはMarkuplintの設定で対応するパーサーを読み込んでください。表のパッケージは`@d-zero/markuplint-config`の依存に含まれないので、使うものを開発依存に追加します。
|
|
23
|
+
|
|
24
|
+
| 拡張子 | Markuplintの設定 |
|
|
25
|
+
| --------------- | -------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `.pug` | `@markuplint/pug-parser`を追加し`@d-zero/markuplint-config/pug`をextends |
|
|
27
|
+
| `.jsx` / `.tsx` | `@markuplint/jsx-parser`と`@markuplint/react-spec`を追加し`@d-zero/markuplint-config/jsx`をextends |
|
|
28
|
+
| `.vue` | `@markuplint/vue-parser`と`@markuplint/vue-spec`を設定 |
|
|
29
|
+
| `.svelte` | `@markuplint/svelte-parser`と`@markuplint/svelte-spec`を設定 |
|
|
30
|
+
| `.astro` | `@markuplint/astro-parser`を設定 |
|
|
31
|
+
|
|
18
32
|
### 拡張
|
|
19
33
|
|
|
20
34
|
プロジェクトに合わせて設定を追加します。
|
package/dist/commands.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export const commands = {
|
|
2
2
|
cspell: 'cspell --no-must-find-files --show-suggestions',
|
|
3
3
|
eslint: 'eslint --fix',
|
|
4
|
-
|
|
4
|
+
// Markuplint v5 は警告だけなら終了コード 0 で終わるため、Markuplint v4 と同じく警告でもコミットを止める
|
|
5
|
+
markuplint: 'markuplint --no-allow-warnings',
|
|
6
|
+
oxfmt: 'oxfmt --write',
|
|
7
|
+
oxlint: 'oxlint --fix',
|
|
5
8
|
prettier: 'prettier --write',
|
|
6
9
|
puglint: 'pug-lint',
|
|
7
10
|
stylelint: 'stylelint --fix',
|
package/dist/default-mapping.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export const defaultMapping = {
|
|
2
|
-
astro: ['
|
|
3
|
-
cjs: ['
|
|
4
|
-
css: ['stylelint', '
|
|
5
|
-
cts: ['
|
|
6
|
-
html: ['markuplint', '
|
|
7
|
-
js: ['
|
|
8
|
-
json: ['
|
|
9
|
-
jsx: ['
|
|
10
|
-
md: ['
|
|
11
|
-
mdx: ['
|
|
12
|
-
mjs: ['
|
|
13
|
-
mts: ['
|
|
2
|
+
astro: ['oxlint', 'markuplint', 'prettier', 'cspell'],
|
|
3
|
+
cjs: ['oxlint', 'oxfmt', 'cspell'],
|
|
4
|
+
css: ['stylelint', 'oxfmt', 'cspell'],
|
|
5
|
+
cts: ['oxlint', 'oxfmt', 'cspell'],
|
|
6
|
+
html: ['markuplint', 'oxfmt', 'cspell'],
|
|
7
|
+
js: ['oxlint', 'oxfmt', 'cspell'],
|
|
8
|
+
json: ['oxfmt', 'cspell'],
|
|
9
|
+
jsx: ['oxlint', 'markuplint', 'oxfmt', 'cspell'],
|
|
10
|
+
md: ['oxfmt', 'textlint', 'cspell'],
|
|
11
|
+
mdx: ['oxfmt', 'textlint', 'cspell'],
|
|
12
|
+
mjs: ['oxlint', 'oxfmt', 'cspell'],
|
|
13
|
+
mts: ['oxlint', 'oxfmt', 'cspell'],
|
|
14
14
|
pug: ['markuplint', 'prettier', 'cspell'],
|
|
15
|
-
scss: ['stylelint', '
|
|
16
|
-
svelte: ['
|
|
17
|
-
ts: ['
|
|
18
|
-
tsx: ['
|
|
19
|
-
vue: ['
|
|
20
|
-
yaml: ['cspell'],
|
|
21
|
-
yml: ['cspell'],
|
|
15
|
+
scss: ['stylelint', 'oxfmt', 'cspell'],
|
|
16
|
+
svelte: ['oxlint', 'markuplint', 'oxfmt', 'cspell'],
|
|
17
|
+
ts: ['oxlint', 'oxfmt', 'cspell'],
|
|
18
|
+
tsx: ['oxlint', 'markuplint', 'oxfmt', 'cspell'],
|
|
19
|
+
vue: ['oxlint', 'markuplint', 'oxfmt', 'cspell'],
|
|
20
|
+
yaml: ['oxfmt', 'cspell'],
|
|
21
|
+
yml: ['oxfmt', 'cspell'],
|
|
22
22
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ export interface DirectoryOptions {
|
|
|
12
12
|
export type IgnoreMap = Partial<Record<CommandType, string | string[]>>;
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
15
|
-
* @param dirOptions
|
|
16
|
-
* @param mapping
|
|
15
|
+
* @param dirOptions - The directory to search, or an options object
|
|
16
|
+
* @param mapping - The extension-to-command mapping to use instead of the default
|
|
17
|
+
* @returns A lint-staged command mapper
|
|
17
18
|
*/
|
|
18
|
-
export default function (dirOptions?: string | DirectoryOptions, mapping?: CommandMappings): LintStagedCommandMapper;
|
|
19
|
+
export default function lintStagedConfigGenerator(dirOptions?: string | DirectoryOptions, mapping?: CommandMappings): LintStagedCommandMapper;
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,16 @@ import { commands } from './commands.js';
|
|
|
3
3
|
import { defaultMapping } from './default-mapping.js';
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
|
-
* @param dirOptions
|
|
7
|
-
* @param mapping
|
|
6
|
+
* @param dirOptions - The directory to search, or an options object
|
|
7
|
+
* @param mapping - The extension-to-command mapping to use instead of the default
|
|
8
|
+
* @returns A lint-staged command mapper
|
|
8
9
|
*/
|
|
9
|
-
export default function (dirOptions, mapping) {
|
|
10
|
+
export default function lintStagedConfigGenerator(dirOptions, mapping) {
|
|
10
11
|
return (allStagedFiles) => {
|
|
11
12
|
const commandList = [];
|
|
12
13
|
const cwd = process.cwd();
|
|
13
14
|
const dir = typeof dirOptions === 'string' ? dirOptions : dirOptions?.dir;
|
|
14
|
-
const ignore = typeof dirOptions === 'string' ?
|
|
15
|
+
const ignore = typeof dirOptions === 'string' ? undefined : dirOptions?.ignore;
|
|
15
16
|
const baseDir = dir
|
|
16
17
|
? // 絶対パスかどうか
|
|
17
18
|
path.isAbsolute(dir)
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type TargetFileExtension = 'astro' | 'cjs' | 'css' | 'cts' | 'html' | 'js' | 'json' | 'jsx' | 'md' | 'mdx' | 'mjs' | 'mts' | 'pug' | 'scss' | 'svelte' | 'ts' | 'tsx' | 'vue' | 'yaml' | 'yml';
|
|
2
|
-
export type CommandType = 'cspell' | 'eslint' | 'markuplint' | 'prettier' | 'puglint' | 'stylelint' | 'textlint';
|
|
2
|
+
export type CommandType = 'cspell' | 'eslint' | 'markuplint' | 'oxfmt' | 'oxlint' | 'prettier' | 'puglint' | 'stylelint' | 'textlint';
|
|
3
3
|
export type CommandMappings = Readonly<Partial<Record<TargetFileExtension, CommandType[]>>>;
|
|
4
4
|
/**
|
|
5
5
|
* @see https://github.com/okonet/lint-staged#example-export-a-function-to-build-your-own-matchers
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/lint-staged-config",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.3",
|
|
4
4
|
"description": "Configurations of lint-staged",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "D-ZERO Co., Ltd.",
|
|
5
7
|
"repository": {
|
|
6
8
|
"type": "git",
|
|
7
9
|
"url": "https://github.com/d-zero-dev/linters.git",
|
|
8
10
|
"directory": "packages/@d-zero/lint-staged-config"
|
|
9
11
|
},
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"access": "public"
|
|
14
|
-
},
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": ">=22.0.0"
|
|
17
|
-
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
18
15
|
"type": "module",
|
|
19
16
|
"exports": {
|
|
20
17
|
"import": "./dist/index.js",
|
|
21
18
|
"types": "./dist/index.d.ts"
|
|
22
19
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
26
23
|
"scripts": {
|
|
27
24
|
"build": "tsc"
|
|
28
25
|
},
|
|
29
26
|
"dependencies": {
|
|
30
|
-
"lint-staged": "
|
|
27
|
+
"lint-staged": "17.6.0"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.0.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "b03aff7503c8440b023d79f81c11d44887aa9fc9"
|
|
33
33
|
}
|