@alexaegis/lint-staged-config 0.0.1
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/index.cjs +28 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +11 -0
- package/index.d.ts.map +1 -0
- package/index.js +28 -0
- package/index.js.map +1 -0
- package/license +21 -0
- package/manifest.json +7 -0
- package/package.json +79 -0
- package/readme.md +3 -0
package/index.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("@alexaegis/fs");
|
|
4
|
+
const node_path = require("node:path");
|
|
5
|
+
const prettierCommand = "prettier --check";
|
|
6
|
+
const tscCommand = "tsc --noEmit";
|
|
7
|
+
const eslintSingleFileCommand = "eslint --max-warnings=0 --no-ignore";
|
|
8
|
+
const markdownCommand = "remark --frail --no-stdout --silently-ignore";
|
|
9
|
+
const lintStagedConfig = {
|
|
10
|
+
"**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)?(x)": (filenames) => {
|
|
11
|
+
const groups = fs.groupByCommonNearestFile(filenames, "tsconfig.json");
|
|
12
|
+
return Object.keys(groups).map(
|
|
13
|
+
(tsRoot) => `${tscCommand} --project ${node_path.join(tsRoot, "tsconfig.json")}`
|
|
14
|
+
);
|
|
15
|
+
},
|
|
16
|
+
"**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)": [eslintSingleFileCommand, prettierCommand],
|
|
17
|
+
"*.css": ["stylelint", prettierCommand],
|
|
18
|
+
"*.scss": ["stylelint --customSyntax=postcss-scss", prettierCommand],
|
|
19
|
+
"(*.json|.eslintrc|.prettierrc|.stylelintrc|.markdownlintrc)": [
|
|
20
|
+
eslintSingleFileCommand,
|
|
21
|
+
prettierCommand
|
|
22
|
+
],
|
|
23
|
+
"*.svelte": ["svelte-check", prettierCommand],
|
|
24
|
+
"*.md": [markdownCommand, prettierCommand],
|
|
25
|
+
"*.(yml|yaml)": [prettierCommand]
|
|
26
|
+
};
|
|
27
|
+
exports.lintStagedConfig = lintStagedConfig;
|
|
28
|
+
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["// For the glob features check out https://github.com/micromatch/micromatch\nimport { groupByCommonNearestFile } from '@alexaegis/fs';\nimport { join } from 'node:path';\n\nconst prettierCommand = 'prettier --check';\nconst tscCommand = 'tsc --noEmit';\n\nconst eslintSingleFileCommand = 'eslint --max-warnings=0 --no-ignore';\nconst markdownCommand = 'remark --frail --no-stdout --silently-ignore';\n\n// TODO: explore more optimal settings since eslint is slow when used on files 1 by 1\n\nexport const lintStagedConfig = {\n\t'**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)?(x)': (filenames: string[]): string[] => {\n\t\tconst groups = groupByCommonNearestFile(filenames, 'tsconfig.json');\n\t\treturn Object.keys(groups).map(\n\t\t\t(tsRoot) => `${tscCommand} --project ${join(tsRoot, 'tsconfig.json')}`\n\t\t);\n\t},\n\t'**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)': [eslintSingleFileCommand, prettierCommand],\n\t'*.css': ['stylelint', prettierCommand],\n\t'*.scss': ['stylelint --customSyntax=postcss-scss', prettierCommand],\n\t'(*.json|.eslintrc|.prettierrc|.stylelintrc|.markdownlintrc)': [\n\t\teslintSingleFileCommand,\n\t\tprettierCommand,\n\t],\n\t'*.svelte': ['svelte-check', prettierCommand],\n\t'*.md': [markdownCommand, prettierCommand],\n\t'*.(yml|yaml)': [prettierCommand],\n};\n"],"names":["groupByCommonNearestFile","join"],"mappings":";;;;AAIA,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAEnB,MAAM,0BAA0B;AAChC,MAAM,kBAAkB;AAIjB,MAAM,mBAAmB;AAAA,EAC/B,6CAA6C,CAAC,cAAkC;AACzE,UAAA,SAASA,GAAAA,yBAAyB,WAAW,eAAe;AAC3D,WAAA,OAAO,KAAK,MAAM,EAAE;AAAA,MAC1B,CAAC,WAAW,GAAG,wBAAwBC,UAAAA,KAAK,QAAQ,eAAe;AAAA,IAAA;AAAA,EAErE;AAAA,EACA,yCAAyC,CAAC,yBAAyB,eAAe;AAAA,EAClF,SAAS,CAAC,aAAa,eAAe;AAAA,EACtC,UAAU,CAAC,yCAAyC,eAAe;AAAA,EACnE,+DAA+D;AAAA,IAC9D;AAAA,IACA;AAAA,EACD;AAAA,EACA,YAAY,CAAC,gBAAgB,eAAe;AAAA,EAC5C,QAAQ,CAAC,iBAAiB,eAAe;AAAA,EACzC,gBAAgB,CAAC,eAAe;AACjC;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const lintStagedConfig: {
|
|
2
|
+
'**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)?(x)': (filenames: string[]) => string[];
|
|
3
|
+
'**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)': string[];
|
|
4
|
+
'*.css': string[];
|
|
5
|
+
'*.scss': string[];
|
|
6
|
+
'(*.json|.eslintrc|.prettierrc|.stylelintrc|.markdownlintrc)': string[];
|
|
7
|
+
'*.svelte': string[];
|
|
8
|
+
'*.md': string[];
|
|
9
|
+
'*.(yml|yaml)': string[];
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,gBAAgB;6DAC6B,MAAM,EAAE,KAAG,MAAM,EAAE;;;;;;;;CAgB5E,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { groupByCommonNearestFile } from "@alexaegis/fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const prettierCommand = "prettier --check";
|
|
4
|
+
const tscCommand = "tsc --noEmit";
|
|
5
|
+
const eslintSingleFileCommand = "eslint --max-warnings=0 --no-ignore";
|
|
6
|
+
const markdownCommand = "remark --frail --no-stdout --silently-ignore";
|
|
7
|
+
const lintStagedConfig = {
|
|
8
|
+
"**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)?(x)": (filenames) => {
|
|
9
|
+
const groups = groupByCommonNearestFile(filenames, "tsconfig.json");
|
|
10
|
+
return Object.keys(groups).map(
|
|
11
|
+
(tsRoot) => `${tscCommand} --project ${join(tsRoot, "tsconfig.json")}`
|
|
12
|
+
);
|
|
13
|
+
},
|
|
14
|
+
"**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)": [eslintSingleFileCommand, prettierCommand],
|
|
15
|
+
"*.css": ["stylelint", prettierCommand],
|
|
16
|
+
"*.scss": ["stylelint --customSyntax=postcss-scss", prettierCommand],
|
|
17
|
+
"(*.json|.eslintrc|.prettierrc|.stylelintrc|.markdownlintrc)": [
|
|
18
|
+
eslintSingleFileCommand,
|
|
19
|
+
prettierCommand
|
|
20
|
+
],
|
|
21
|
+
"*.svelte": ["svelte-check", prettierCommand],
|
|
22
|
+
"*.md": [markdownCommand, prettierCommand],
|
|
23
|
+
"*.(yml|yaml)": [prettierCommand]
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
lintStagedConfig
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["// For the glob features check out https://github.com/micromatch/micromatch\nimport { groupByCommonNearestFile } from '@alexaegis/fs';\nimport { join } from 'node:path';\n\nconst prettierCommand = 'prettier --check';\nconst tscCommand = 'tsc --noEmit';\n\nconst eslintSingleFileCommand = 'eslint --max-warnings=0 --no-ignore';\nconst markdownCommand = 'remark --frail --no-stdout --silently-ignore';\n\n// TODO: explore more optimal settings since eslint is slow when used on files 1 by 1\n\nexport const lintStagedConfig = {\n\t'**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)?(x)': (filenames: string[]): string[] => {\n\t\tconst groups = groupByCommonNearestFile(filenames, 'tsconfig.json');\n\t\treturn Object.keys(groups).map(\n\t\t\t(tsRoot) => `${tscCommand} --project ${join(tsRoot, 'tsconfig.json')}`\n\t\t);\n\t},\n\t'**/!(shims)/*.(ts|js|cts|cjs|mts|mjs)': [eslintSingleFileCommand, prettierCommand],\n\t'*.css': ['stylelint', prettierCommand],\n\t'*.scss': ['stylelint --customSyntax=postcss-scss', prettierCommand],\n\t'(*.json|.eslintrc|.prettierrc|.stylelintrc|.markdownlintrc)': [\n\t\teslintSingleFileCommand,\n\t\tprettierCommand,\n\t],\n\t'*.svelte': ['svelte-check', prettierCommand],\n\t'*.md': [markdownCommand, prettierCommand],\n\t'*.(yml|yaml)': [prettierCommand],\n};\n"],"names":[],"mappings":";;AAIA,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAEnB,MAAM,0BAA0B;AAChC,MAAM,kBAAkB;AAIjB,MAAM,mBAAmB;AAAA,EAC/B,6CAA6C,CAAC,cAAkC;AACzE,UAAA,SAAS,yBAAyB,WAAW,eAAe;AAC3D,WAAA,OAAO,KAAK,MAAM,EAAE;AAAA,MAC1B,CAAC,WAAW,GAAG,wBAAwB,KAAK,QAAQ,eAAe;AAAA,IAAA;AAAA,EAErE;AAAA,EACA,yCAAyC,CAAC,yBAAyB,eAAe;AAAA,EAClF,SAAS,CAAC,aAAa,eAAe;AAAA,EACtC,UAAU,CAAC,yCAAyC,eAAe;AAAA,EACnE,+DAA+D;AAAA,IAC9D;AAAA,IACA;AAAA,EACD;AAAA,EACA,YAAY,CAAC,gBAAgB,eAAe;AAAA,EAC5C,QAAQ,CAAC,iBAAiB,eAAe;AAAA,EACzC,gBAAgB,CAAC,eAAe;AACjC;"}
|
package/license
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Győri Sándor
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/manifest.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alexaegis/lint-staged-config",
|
|
3
|
+
"description": "Lint staged config",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"license": "mit",
|
|
6
|
+
"private": false,
|
|
7
|
+
"author": {
|
|
8
|
+
"email": "alexaegis@gmail.com",
|
|
9
|
+
"name": "Alex Aegis",
|
|
10
|
+
"url": "https://github.com/AlexAegis"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/AlexAegis/js-tooling",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"email": "alexaegis@gmail.com",
|
|
15
|
+
"url": "https://github.com/AlexAegis/js-tooling/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"eslint",
|
|
19
|
+
"javascript",
|
|
20
|
+
"js",
|
|
21
|
+
"ts",
|
|
22
|
+
"tsconfig",
|
|
23
|
+
"turbo",
|
|
24
|
+
"typescript"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"config": {
|
|
28
|
+
"engine-strict": true
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.13.0"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./index.d.ts",
|
|
39
|
+
"import": "./index.js",
|
|
40
|
+
"require": "./index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"./readme": "./readme.md"
|
|
43
|
+
},
|
|
44
|
+
"bin": {
|
|
45
|
+
"lint-staged": "./node_modules/lint-staged/bin/lint-staged.js"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@alexaegis/fs": "0.0.23",
|
|
49
|
+
"lint-staged": "13.1.2"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"typescript": "^4.9.5"
|
|
53
|
+
},
|
|
54
|
+
"optionalDependencies": {
|
|
55
|
+
"svelte": "^3.55.1"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@alexaegis/vite": "0.0.1",
|
|
59
|
+
"@alexaegis/vitest": "0.0.1",
|
|
60
|
+
"@types/eslint": "^8.21.1",
|
|
61
|
+
"@types/node": "^18.14.6"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "turbo run build-lib_ --concurrency 6 --filter @alexaegis/lint-staged-config",
|
|
65
|
+
"build-lib_": "vite build",
|
|
66
|
+
"lint:es": "turbo run lint:es_ --concurrency 6 --filter @alexaegis/lint-staged-config",
|
|
67
|
+
"lint:es_": "eslint --max-warnings=0 --fix --no-error-on-unmatched-pattern .",
|
|
68
|
+
"lint:format": "turbo run lint:format_ --concurrency 6 --filter @alexaegis/lint-staged-config",
|
|
69
|
+
"lint:format_": "prettier --check .",
|
|
70
|
+
"lint:md": "turbo run lint:md_ --concurrency 6 --filter @alexaegis/lint-staged-config",
|
|
71
|
+
"lint:md_": "remark --frail --no-stdout --silently-ignore *.md docs/**/*.md",
|
|
72
|
+
"lint:tsc": "turbo run lint:tsc_ --concurrency 6 --filter @alexaegis/lint-staged-config",
|
|
73
|
+
"lint:tsc_": "tsc --noEmit",
|
|
74
|
+
"format": "prettier --write .",
|
|
75
|
+
"test": "turbo run test_ --concurrency 6 --filter @alexaegis/lint-staged-config",
|
|
76
|
+
"test_": "vitest --passWithNoTests --coverage --run",
|
|
77
|
+
"test:watch": "vitest --passWithNoTests --coverage --run"
|
|
78
|
+
}
|
|
79
|
+
}
|
package/readme.md
ADDED