linter-bundle 5.0.0 → 5.1.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.
- package/.linter-bundle.js +4 -0
- package/.linter-bundle.schema.json +125 -0
- package/CHANGELOG.md +32 -4
- package/README.md +23 -23
- package/TODO.md +5 -0
- package/eslint.cjs +5 -0
- package/helper/linter-bundle-config.d.ts +7 -7
- package/helper/linter-bundle-config.js +9 -2
- package/package.json +1 -1
- package/stylelint.cjs +5 -0
package/.linter-bundle.js
CHANGED
|
@@ -9,6 +9,7 @@ const snippets = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
|
+
timing: true,
|
|
12
13
|
files: {
|
|
13
14
|
restrictions: [
|
|
14
15
|
{
|
|
@@ -31,13 +32,16 @@ export default {
|
|
|
31
32
|
'.gitattributes',
|
|
32
33
|
'.gitignore',
|
|
33
34
|
'.linter-bundle.js',
|
|
35
|
+
'.linter-bundle.schema.json',
|
|
34
36
|
'.markdownlint.json',
|
|
35
37
|
'.npmignore',
|
|
36
38
|
'*.md',
|
|
39
|
+
'eslint.cjs',
|
|
37
40
|
'LICENSE',
|
|
38
41
|
'lint.js',
|
|
39
42
|
'package-lock.json',
|
|
40
43
|
'package.json',
|
|
44
|
+
'stylelint.cjs',
|
|
41
45
|
'stylelint.config.cjs',
|
|
42
46
|
'test-stylelint.js',
|
|
43
47
|
'tsconfig.json',
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"verbose": {
|
|
6
|
+
"type": "boolean"
|
|
7
|
+
},
|
|
8
|
+
"timing": {
|
|
9
|
+
"type": "boolean"
|
|
10
|
+
},
|
|
11
|
+
"git": {
|
|
12
|
+
"type": "boolean"
|
|
13
|
+
},
|
|
14
|
+
"files": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"restrictions": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"properties": {
|
|
22
|
+
"basePath": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"allowed": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"disallowed": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": [
|
|
39
|
+
"restrictions"
|
|
40
|
+
],
|
|
41
|
+
"additionalProperties": false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": [
|
|
46
|
+
"restrictions"
|
|
47
|
+
],
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
},
|
|
50
|
+
"tsc": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": {
|
|
53
|
+
"tsconfig": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"additionalProperties": false
|
|
58
|
+
},
|
|
59
|
+
"ts": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"properties": {
|
|
62
|
+
"tsconfig": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"include": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"items": {
|
|
68
|
+
"type": "string"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"exclude": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "string"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"overrides": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"properties": {
|
|
80
|
+
"general": {
|
|
81
|
+
"type": "object"
|
|
82
|
+
},
|
|
83
|
+
"react": {
|
|
84
|
+
"type": "object"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"additionalProperties": false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"additionalProperties": false
|
|
91
|
+
},
|
|
92
|
+
"sass": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"patternPrefix": {
|
|
96
|
+
"type": "string"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"additionalProperties": false
|
|
100
|
+
},
|
|
101
|
+
"audit": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"minSeverity": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"enum": [
|
|
107
|
+
"info",
|
|
108
|
+
"low",
|
|
109
|
+
"moderate",
|
|
110
|
+
"high",
|
|
111
|
+
"critical"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"exclude": {
|
|
115
|
+
"type": "array",
|
|
116
|
+
"items": {
|
|
117
|
+
"type": "string"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"additionalProperties": false
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"additionalProperties": false
|
|
125
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -6,14 +6,39 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
-
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v5.
|
|
9
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v5.1.0...HEAD)
|
|
10
|
+
|
|
11
|
+
## [5.1.0] - 2023-09-03
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- [general] Added basic schema for `.linter-bundle.json` configuration file
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- [general] Fix support for `.linter-bundle.json`
|
|
20
|
+
|
|
21
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v5.0.1...v5.1.0)
|
|
22
|
+
|
|
23
|
+
## [5.0.1] - 2023-09-03
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- [general] Updated [README.md](./README.md) to reflect breaking changes in v5.0.0.
|
|
28
|
+
|
|
29
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v5.0.0...v5.0.1)
|
|
10
30
|
|
|
11
31
|
## [5.0.0] - 2023-09-03
|
|
12
32
|
|
|
13
|
-
|
|
33
|
+
### Breaking change
|
|
14
34
|
|
|
15
35
|
- [general] Migrated the code base from CommonJS to ESModules (as far as possible, because ESLint currently does not support ESModules)
|
|
16
36
|
- [general] The linter-bundle configuration can now be a ESModule (`.linter-bundle.mjs` is supported)
|
|
37
|
+
- [general] `"extends"` in the .eslintrc.js needs to be suffixed with the ".cjs" file extension (e.g. `require.resolve('linter-bundle/eslint.cjs')`)
|
|
38
|
+
- [general] `"extends"` in the stylelint.config.js needs to be suffixed with the ".cjs" file extension (e.g. `require.resolve('linter-bundle/stylelint.cjs')`)
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
17
42
|
- [files] Report unmatched `allowed` pattern
|
|
18
43
|
- [markdownlint] Updated `markdownlint-cli` from `0.35.0` to `0.36.0`
|
|
19
44
|
- [eslint] Disabled `considerComments` option of [`import/new-after-import`](https://github.com/import-js/eslint-plugin-import/blob/v2.28.1/docs/rules/newline-after-import.md) rule
|
|
@@ -24,7 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
24
49
|
|
|
25
50
|
## [4.0.3] - 2023-08-31
|
|
26
51
|
|
|
27
|
-
###
|
|
52
|
+
### Fixed
|
|
28
53
|
|
|
29
54
|
- [files] Don't show "No relevant files changed." if the `--git`` option was not used
|
|
30
55
|
|
|
@@ -32,7 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
32
57
|
|
|
33
58
|
## [4.0.2] - 2023-08-31
|
|
34
59
|
|
|
35
|
-
###
|
|
60
|
+
### Fixed
|
|
36
61
|
|
|
37
62
|
- [files] Don't append `"**"` as fallback argument to the command line
|
|
38
63
|
|
|
@@ -43,6 +68,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
43
68
|
### Changed
|
|
44
69
|
|
|
45
70
|
- [eslint] Disabled `unicorn/filename-case` in favour of the new linter-bundle `files` task
|
|
71
|
+
|
|
72
|
+
### Fixed
|
|
73
|
+
|
|
46
74
|
- [files] Fixed path to `files` task
|
|
47
75
|
|
|
48
76
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v4.0.0...v4.0.1)
|
package/README.md
CHANGED
|
@@ -86,16 +86,16 @@ npm install linter-bundle --save-dev
|
|
|
86
86
|
```js
|
|
87
87
|
module.exports = {
|
|
88
88
|
extends: [
|
|
89
|
-
require.resolve('linter-bundle/eslint'),
|
|
90
|
-
// require.resolve('linter-bundle/eslint/overrides-gatsby'),
|
|
91
|
-
// require.resolve('linter-bundle/eslint/overrides-javascript'),
|
|
92
|
-
require.resolve('linter-bundle/eslint/overrides-javascript-lazy'),
|
|
93
|
-
// require.resolve('linter-bundle/eslint/overrides-jest'),
|
|
94
|
-
require.resolve('linter-bundle/eslint/overrides-jsdoc'),
|
|
95
|
-
// require.resolve('linter-bundle/eslint/overrides-react'),
|
|
96
|
-
// require.resolve('linter-bundle/eslint/overrides-storybook'),
|
|
97
|
-
// require.resolve('linter-bundle/eslint/overrides-type-declarations'),
|
|
98
|
-
// require.resolve('linter-bundle/eslint/overrides-worker')
|
|
89
|
+
require.resolve('linter-bundle/eslint.cjs'),
|
|
90
|
+
// require.resolve('linter-bundle/eslint/overrides-gatsby.cjs'),
|
|
91
|
+
// require.resolve('linter-bundle/eslint/overrides-javascript.cjs'),
|
|
92
|
+
require.resolve('linter-bundle/eslint/overrides-javascript-lazy.cjs'),
|
|
93
|
+
// require.resolve('linter-bundle/eslint/overrides-jest.cjs'),
|
|
94
|
+
require.resolve('linter-bundle/eslint/overrides-jsdoc.cjs'),
|
|
95
|
+
// require.resolve('linter-bundle/eslint/overrides-react.cjs'),
|
|
96
|
+
// require.resolve('linter-bundle/eslint/overrides-storybook.cjs'),
|
|
97
|
+
// require.resolve('linter-bundle/eslint/overrides-type-declarations.cjs'),
|
|
98
|
+
// require.resolve('linter-bundle/eslint/overrides-worker.cjs')
|
|
99
99
|
]
|
|
100
100
|
};
|
|
101
101
|
```
|
|
@@ -104,22 +104,22 @@ module.exports = {
|
|
|
104
104
|
|
|
105
105
|
Source | Description | Rules setup
|
|
106
106
|
-|-|-
|
|
107
|
-
`linter-bundle/eslint` | General rule setup. This is also the base for the following **overrides**. | [View](./eslint/index.
|
|
108
|
-
`linter-bundle/eslint/overrides-gatsby` | Settings for Gatsby-based projects. | [View](./eslint/overrides-gatsby.js)
|
|
109
|
-
`linter-bundle/eslint/overrides-javascript` | Strict settings for JavaScript files, which enforces correct types everywhere. | [View](./eslint/overrides-javascript.
|
|
110
|
-
`linter-bundle/eslint/overrides-javascript-lazy` | Can be used instead of `overrides-javascript`. It's less strict and allows the `any` type. | [View](./eslint/overrides-javascript-lazy.
|
|
111
|
-
`linter-bundle/eslint/overrides-jest` | Settings for projects using Jest. | [View](./eslint/overrides-jest.
|
|
112
|
-
`linter-bundle/eslint/overrides-jsdoc` | Settings for projects using JSDoc comments. | [View](./eslint/overrides-jsdoc.
|
|
113
|
-
`linter-bundle/eslint/overrides-react` | Settings for projects using React comments. | [View](./eslint/overrides-react.
|
|
114
|
-
`linter-bundle/eslint/overrides-storybook` | Settings for projects using Storybook comments. | [View](./eslint/overrides-storybook.
|
|
115
|
-
`linter-bundle/eslint/overrides-type-declarations` | Settings for type declaration files (.d.ts). | [View](./eslint/overrides-type-declarations.
|
|
116
|
-
`linter-bundle/eslint/overrides-worker` | Settings for projects using Web Workers. | [View](./eslint/overrides-worker.
|
|
107
|
+
`linter-bundle/eslint.cjs` | General rule setup. This is also the base for the following **overrides**. | [View](./eslint/index.cjs)
|
|
108
|
+
`linter-bundle/eslint/overrides-gatsby.cjs` | Settings for Gatsby-based projects. | [View](./eslint/overrides-gatsby.js)
|
|
109
|
+
`linter-bundle/eslint/overrides-javascript.cjs` | Strict settings for JavaScript files, which enforces correct types everywhere. | [View](./eslint/overrides-javascript.cjs)
|
|
110
|
+
`linter-bundle/eslint/overrides-javascript-lazy.cjs` | Can be used instead of `overrides-javascript`. It's less strict and allows the `any` type. | [View](./eslint/overrides-javascript-lazy.cjs)
|
|
111
|
+
`linter-bundle/eslint/overrides-jest.cjs` | Settings for projects using Jest. | [View](./eslint/overrides-jest.cjs)
|
|
112
|
+
`linter-bundle/eslint/overrides-jsdoc.cjs` | Settings for projects using JSDoc comments. | [View](./eslint/overrides-jsdoc.cjs)
|
|
113
|
+
`linter-bundle/eslint/overrides-react.cjs` | Settings for projects using React comments. | [View](./eslint/overrides-react.cjs)
|
|
114
|
+
`linter-bundle/eslint/overrides-storybook.cjs` | Settings for projects using Storybook comments. | [View](./eslint/overrides-storybook.cjs)
|
|
115
|
+
`linter-bundle/eslint/overrides-type-declarations.cjs` | Settings for type declaration files (.d.ts). | [View](./eslint/overrides-type-declarations.cjs)
|
|
116
|
+
`linter-bundle/eslint/overrides-worker.cjs` | Settings for projects using Web Workers. | [View](./eslint/overrides-worker.cjs)
|
|
117
117
|
|
|
118
118
|
#### stylelint.config.js
|
|
119
119
|
|
|
120
120
|
```js
|
|
121
121
|
module.exports = {
|
|
122
|
-
extends: 'linter-bundle/stylelint'
|
|
122
|
+
extends: 'linter-bundle/stylelint.cjs'
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
```
|
|
@@ -309,7 +309,7 @@ module.exports = {
|
|
|
309
309
|
*/
|
|
310
310
|
overrides: {
|
|
311
311
|
/**
|
|
312
|
-
* Rules that are applied to `linter-bundle/eslint`.
|
|
312
|
+
* Rules that are applied to `linter-bundle/eslint.cjs`.
|
|
313
313
|
*/
|
|
314
314
|
general: {
|
|
315
315
|
'no-restricted-globals': {
|
|
@@ -363,7 +363,7 @@ module.exports = {
|
|
|
363
363
|
},
|
|
364
364
|
|
|
365
365
|
/**
|
|
366
|
-
* Rules that are applied to `linter-bundle/eslint/overrides-react`.
|
|
366
|
+
* Rules that are applied to `linter-bundle/eslint/overrides-react.cjs`.
|
|
367
367
|
*/
|
|
368
368
|
react: {
|
|
369
369
|
'react/forbid-component-props': {
|
package/TODO.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @todo
|
|
2
2
|
|
|
3
|
+
- Timing funktioniert nicht - siehe HexEd.it-core
|
|
4
|
+
|
|
5
|
+
- Wie erreichen wir auto-completion in der .linter-bundle.js datei?
|
|
6
|
+
.linter-bundle.json vielleicht mit Schema-Datei?
|
|
7
|
+
|
|
3
8
|
<!-- markdownlint-disable -->
|
|
4
9
|
|
|
5
10
|
- Bereiche in Readme aufklappbar machen:
|
package/eslint.cjs
ADDED
|
@@ -6,6 +6,13 @@ export interface LinterBundleConfig {
|
|
|
6
6
|
verbose?: boolean;
|
|
7
7
|
timing?: boolean;
|
|
8
8
|
git?: boolean;
|
|
9
|
+
files?: {
|
|
10
|
+
restrictions: {
|
|
11
|
+
basePath: string;
|
|
12
|
+
allowed?: string[];
|
|
13
|
+
disallowed?: string[];
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
9
16
|
tsc?: {
|
|
10
17
|
tsconfig?: string;
|
|
11
18
|
};
|
|
@@ -34,13 +41,6 @@ export interface LinterBundleConfig {
|
|
|
34
41
|
minSeverity?: 'info' | 'low' | 'moderate' | 'high' | 'critical';
|
|
35
42
|
exclude?: string[];
|
|
36
43
|
};
|
|
37
|
-
files?: {
|
|
38
|
-
restrictions: {
|
|
39
|
-
basePath: string;
|
|
40
|
-
allowed?: string[];
|
|
41
|
-
disallowed?: string[];
|
|
42
|
-
}[];
|
|
43
|
-
};
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export const linterBundleConfig: LinterBundleConfig;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @file Returns the `.linter-bundle.js` configuration result.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import * as fs from 'node:fs/promises';
|
|
5
6
|
import * as path from 'node:path';
|
|
6
7
|
|
|
7
8
|
export const linterBundleConfig = (
|
|
@@ -19,9 +20,15 @@ export const linterBundleConfig = (
|
|
|
19
20
|
* @returns {Promise<import('./linter-bundle-config.js').LinterBundleConfig | undefined>} - Either the file content for `undefined` if the file does not exist.
|
|
20
21
|
* */
|
|
21
22
|
async function loadConfig (fileName) {
|
|
22
|
-
const filePath = path.join('file://', process.cwd(), fileName);
|
|
23
|
-
|
|
24
23
|
try {
|
|
24
|
+
if (fileName.endsWith('.json')) {
|
|
25
|
+
const content = await fs.readFile(path.join(process.cwd(), fileName), 'utf8');
|
|
26
|
+
|
|
27
|
+
return JSON.parse(content);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const filePath = path.join('file://', process.cwd(), fileName);
|
|
31
|
+
|
|
25
32
|
const config = await import(filePath);
|
|
26
33
|
|
|
27
34
|
if ('default' in config) {
|
package/package.json
CHANGED