@alexlit/lint-kit 112.1.1 → 112.2.0

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.
@@ -1,5 +1,3 @@
1
- import { lintStagedConfig } from '@alexlit/config-hooks';
1
+ import { createLintStagedConfig } from '@alexlit/config-hooks';
2
2
 
3
- export default {
4
- ...lintStagedConfig,
5
- };
3
+ export default createLintStagedConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/lint-kit",
3
- "version": "112.1.1",
3
+ "version": "112.2.0",
4
4
  "private": false,
5
5
  "description": "Preset of configuration files and dependencies for linting web applications (designed for Vue.js with TypeScript)",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/config-eslint",
3
- "version": "79.1.2",
3
+ "version": "79.2.1",
4
4
  "private": false,
5
5
  "description": "Eslint config",
6
6
  "keywords": [
@@ -69,7 +69,7 @@
69
69
  "eslint-plugin-regexp": "^2.4.0",
70
70
  "eslint-plugin-security": "^2.1.1",
71
71
  "eslint-plugin-simple-import-sort": "^12.0.0",
72
- "eslint-plugin-sonarjs": "^0.24.0",
72
+ "eslint-plugin-sonarjs": "^0.25.0",
73
73
  "eslint-plugin-sort-class-members": "^1.20.0",
74
74
  "eslint-plugin-sort-destructure-keys": "^1.5.0",
75
75
  "eslint-plugin-sort-keys-fix": "^1.1.2",
@@ -79,7 +79,7 @@
79
79
  "eslint-plugin-typescript-sort-keys": "^3.2.0",
80
80
  "eslint-plugin-unicorn": "^51.0.1",
81
81
  "eslint-plugin-unused-imports": "^3.1.0",
82
- "eslint-plugin-vitest": "^0.4.0",
82
+ "eslint-plugin-vitest": "^0.4.1",
83
83
  "eslint-plugin-vue": "^9.24.0",
84
84
  "eslint-plugin-vuejs-accessibility": "^2.2.1",
85
85
  "eslint-plugin-wc": "^2.0.4",
@@ -12,11 +12,20 @@ npm i @alexlit/config-hooks -D
12
12
 
13
13
  ```js
14
14
  // lint-staged.config.js
15
- import { lintStagedConfig } from '@alexlit/config-hooks';
16
-
17
- export default {
18
- ...lintStagedConfig,
19
- };
15
+ import { createLintStagedConfig } from '@alexlit/config-hooks';
16
+
17
+ export default createLintStagedConfig(
18
+ // optional plugins list
19
+ {
20
+ stylelint: false,
21
+ },
22
+
23
+ // optional config
24
+ {
25
+ '*.css': [], // disable existing rule
26
+ '*.yaml': ['echo "Hello, .yaml!"'], // custom rule
27
+ },
28
+ );
20
29
  ```
21
30
 
22
31
  - husky
@@ -1,2 +1,2 @@
1
1
  // eslint-disable-next-line import/extensions
2
- export { lintStagedConfig } from './lint-staged.js';
2
+ export { createLintStagedConfig } from './lint-staged.js';
@@ -1,43 +1,75 @@
1
- /* eslint-disable vue/sort-keys */
2
- const eslint = 'eslint --fix';
3
- const htmllint = 'linthtml';
4
- const lockfilelint = 'lockfile-lint --type npm --path package-lock.json';
5
- const markdownlint = 'markdownlint --fix';
6
- const npmlint = 'npmPkgJsonLint';
7
- const prettier = 'prettier --write';
8
- const stylelint = 'stylelint --fix';
9
-
10
- export const lintStagedConfig = {
11
- '*.cjs': [eslint, prettier],
12
- '*.css': [stylelint, prettier],
13
- '*.erb': [prettier],
14
- '*.html': [htmllint, prettier],
15
- '*.jade': [prettier],
16
- '*.js': [eslint, prettier],
17
- '*.json,!package-lock.json': [prettier],
18
- '*.jsonc': [prettier],
19
- '*.jsonp': [prettier],
20
- '*.jsx': [eslint, prettier],
21
- '*.md': [prettier, markdownlint],
22
- '*.mjs': [eslint, prettier],
23
- '*.pcss': [stylelint, prettier],
24
- '*.php': [prettier],
25
- '*.postcss': [stylelint, prettier],
26
- '*.pug': [prettier],
27
- '*.rb': [prettier],
28
- '*.sass': [stylelint, prettier],
29
- '*.scss': [stylelint, prettier],
30
- '*.sh': [prettier],
31
- '*.sol': [prettier],
32
- '*.sql': [prettier],
33
- '*.svg': [prettier],
34
- '*.ts': [eslint, prettier],
35
- '*.tsx': [eslint, prettier],
36
- '*.vue': [eslint, stylelint, prettier],
37
- '*.xml': [prettier],
38
- '*.yaml': [prettier],
39
- '*.yml': [prettier],
40
- 'package-lock.json': [lockfilelint],
41
- // eslint-disable-next-line sort-keys
42
- 'package.json': [npmlint],
1
+ /**
2
+ * Create lint-staged config
3
+ *
4
+ * @param {Record<string, boolean>} plugins Enabled plugins
5
+ * @param {Record<string, any>} config Users config
6
+ *
7
+ * @returns {Record<string, any>} Lint-staged configuration
8
+ */
9
+ const createLintStagedConfig = (plugins = {}, config = {}) => {
10
+ const pluginsList = {
11
+ eslint: true,
12
+ htmllint: true,
13
+ lockfilelint: true,
14
+ markdownlint: true,
15
+ npmlint: true,
16
+ prettier: true,
17
+ stylelint: true,
18
+
19
+ ...plugins,
20
+ };
21
+
22
+ const eslint = pluginsList.eslint ? 'eslint --fix' : 'true';
23
+
24
+ const htmllint = pluginsList.htmllint ? 'linthtml' : 'true';
25
+
26
+ const lockfilelint = pluginsList.lockfilelint
27
+ ? 'lockfile-lint --type npm --path package-lock.json'
28
+ : 'true';
29
+
30
+ const markdownlint = pluginsList.markdownlint ? 'markdownlint --fix' : 'true';
31
+
32
+ const npmlint = pluginsList.npmlint ? 'npmPkgJsonLint' : 'true';
33
+
34
+ const prettier = pluginsList.prettier ? 'prettier --write' : 'true';
35
+
36
+ const stylelint = pluginsList.stylelint ? 'stylelint --fix' : 'true';
37
+
38
+ return {
39
+ '*.cjs': [eslint, prettier],
40
+ '*.css': [stylelint, prettier],
41
+ '*.erb': [prettier],
42
+ '*.html': [htmllint, prettier],
43
+ '*.jade': [prettier],
44
+ '*.js': [eslint, prettier],
45
+ '*.json,!package-lock.json': [prettier],
46
+ '*.jsonc': [prettier],
47
+ '*.jsonp': [prettier],
48
+ '*.jsx': [eslint, prettier],
49
+ '*.md': [prettier, markdownlint],
50
+ '*.mjs': [eslint, prettier],
51
+ '*.pcss': [stylelint, prettier],
52
+ '*.php': [prettier],
53
+ '*.postcss': [stylelint, prettier],
54
+ '*.pug': [prettier],
55
+ '*.rb': [prettier],
56
+ '*.sass': [stylelint, prettier],
57
+ '*.scss': [stylelint, prettier],
58
+ '*.sh': [prettier],
59
+ '*.sol': [prettier],
60
+ '*.sql': [prettier],
61
+ '*.svg': [prettier],
62
+ '*.ts': [eslint, prettier],
63
+ '*.tsx': [eslint, prettier],
64
+ '*.vue': [eslint, stylelint, prettier],
65
+ '*.xml': [prettier],
66
+ '*.yaml': [prettier],
67
+ '*.yml': [prettier],
68
+ 'package-lock.json': [lockfilelint],
69
+ 'package.json': [npmlint],
70
+
71
+ ...config,
72
+ };
43
73
  };
74
+
75
+ export { createLintStagedConfig };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/config-hooks",
3
- "version": "3.0.0",
3
+ "version": "4.1.3",
4
4
  "private": false,
5
5
  "description": "Hooks config",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/config-prettier",
3
- "version": "18.0.1",
3
+ "version": "18.1.0",
4
4
  "private": false,
5
5
  "description": "prettier config",
6
6
  "keywords": [
@@ -36,10 +36,10 @@
36
36
  "@prettier/plugin-php": "^0.22.2",
37
37
  "@prettier/plugin-pug": "^3.0.0",
38
38
  "@prettier/plugin-ruby": "^4.0.4",
39
- "@prettier/plugin-xml": "^3.3.1",
39
+ "@prettier/plugin-xml": "^3.4.1",
40
40
  "prettier": "^3.2.5",
41
41
  "prettier-plugin-jsdoc": "^1.3.0",
42
- "prettier-plugin-packagejson": "^2.4.13",
42
+ "prettier-plugin-packagejson": "^2.4.14",
43
43
  "prettier-plugin-sh": "^0.14.0",
44
44
  "prettier-plugin-solidity": "^1.3.1",
45
45
  "prettier-plugin-sort-json": "^4.0.0",