@saashub/qoq-eslint-v9-ts-vitest 0.7.7 → 0.7.9
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/coverage/baseConfig.ts.html +1 -1
- package/coverage/clover.xml +21 -14
- package/coverage/coverage-final.json +1 -1
- package/coverage/eslintConfig.ts.html +54 -21
- package/coverage/index.html +11 -11
- package/lib/eslintConfig.d.ts +3 -2
- package/lib/eslintConfig.js +13 -8
- package/lib/eslintConfig.mjs +10 -8
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/index.mjs +1 -1
- package/package.json +6 -5
- package/rollup.config.js +2 -2
- package/src/eslintConfig.spec.ts +3 -3
- package/src/eslintConfig.ts +20 -9
@@ -136,7 +136,7 @@ export default config;
|
|
136
136
|
<div class='footer quiet pad2 space-top1 center small'>
|
137
137
|
Code coverage generated by
|
138
138
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
139
|
-
at 2024-
|
139
|
+
at 2024-09-06T07:21:47.149Z
|
140
140
|
</div>
|
141
141
|
<script src="prettify.js"></script>
|
142
142
|
<script>
|
package/coverage/clover.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<coverage generated="
|
3
|
-
<project timestamp="
|
4
|
-
<metrics statements="
|
2
|
+
<coverage generated="1725607307163" clover="3.2.0">
|
3
|
+
<project timestamp="1725607307164" name="All files">
|
4
|
+
<metrics statements="35" coveredstatements="35" conditionals="2" coveredconditionals="1" methods="1" coveredmethods="1" elements="38" coveredelements="37" complexity="0" loc="35" ncloc="35" packages="1" files="2" classes="2"/>
|
5
5
|
<file name="baseConfig.ts" path="/home/ladamczyk/Desktop/projects/qoq/packages/eslint-v9-ts-vitest/src/baseConfig.ts">
|
6
6
|
<metrics statements="17" coveredstatements="17" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
7
7
|
<line num="1" count="1" type="stmt"/>
|
@@ -23,18 +23,25 @@
|
|
23
23
|
<line num="22" count="1" type="stmt"/>
|
24
24
|
</file>
|
25
25
|
<file name="eslintConfig.ts" path="/home/ladamczyk/Desktop/projects/qoq/packages/eslint-v9-ts-vitest/src/eslintConfig.ts">
|
26
|
-
<metrics statements="
|
26
|
+
<metrics statements="18" coveredstatements="18" conditionals="2" coveredconditionals="1" methods="1" coveredmethods="1"/>
|
27
27
|
<line num="1" count="1" type="stmt"/>
|
28
|
-
<line num="
|
29
|
-
<line num="
|
30
|
-
<line num="
|
31
|
-
<line num="
|
32
|
-
<line num="
|
33
|
-
<line num="
|
34
|
-
<line num="
|
35
|
-
<line num="
|
36
|
-
<line num="
|
37
|
-
<line num="
|
28
|
+
<line num="2" count="1" type="stmt"/>
|
29
|
+
<line num="4" count="1" type="stmt"/>
|
30
|
+
<line num="8" count="1" type="stmt"/>
|
31
|
+
<line num="10" count="1" type="stmt"/>
|
32
|
+
<line num="15" count="1" type="cond" truecount="1" falsecount="0"/>
|
33
|
+
<line num="16" count="2" type="stmt"/>
|
34
|
+
<line num="17" count="2" type="stmt"/>
|
35
|
+
<line num="18" count="2" type="stmt"/>
|
36
|
+
<line num="19" count="2" type="stmt"/>
|
37
|
+
<line num="20" count="2" type="stmt"/>
|
38
|
+
<line num="21" count="2" type="stmt"/>
|
39
|
+
<line num="22" count="2" type="stmt"/>
|
40
|
+
<line num="23" count="2" type="stmt"/>
|
41
|
+
<line num="24" count="2" type="stmt"/>
|
42
|
+
<line num="26" count="2" type="cond" truecount="0" falsecount="1"/>
|
43
|
+
<line num="27" count="2" type="stmt"/>
|
44
|
+
<line num="29" count="1" type="stmt"/>
|
38
45
|
</file>
|
39
46
|
</project>
|
40
47
|
</coverage>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
{"/home/ladamczyk/Desktop/projects/qoq/packages/eslint-v9-ts-vitest/src/baseConfig.ts": {"path":"/home/ladamczyk/Desktop/projects/qoq/packages/eslint-v9-ts-vitest/src/baseConfig.ts","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":53}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":77}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":64}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":36}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":21}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":5}},"11":{"start":{"line":12,"column":0},"end":{"line":12,"column":85}},"12":{"start":{"line":13,"column":0},"end":{"line":13,"column":15}},"13":{"start":{"line":14,"column":0},"end":{"line":14,"column":3}},"14":{"start":{"line":15,"column":0},"end":{"line":15,"column":45}},"15":{"start":{"line":16,"column":0},"end":{"line":16,"column":12}},"16":{"start":{"line":17,"column":0},"end":{"line":17,"column":39}},"17":{"start":{"line":18,"column":0},"end":{"line":18,"column":6}},"18":{"start":{"line":19,"column":0},"end":{"line":19,"column":3}},"19":{"start":{"line":20,"column":0},"end":{"line":20,"column":30}},"21":{"start":{"line":22,"column":0},"end":{"line":22,"column":22}}},"s":{"0":1,"1":1,"2":1,"3":1,"5":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"21":1},"branchMap":{},"b":{},"fnMap":{},"f":{}}
|
2
|
-
,"/home/ladamczyk/Desktop/projects/qoq/packages/eslint-v9-ts-vitest/src/eslintConfig.ts": {"path":"/home/ladamczyk/Desktop/projects/qoq/packages/eslint-v9-ts-vitest/src/eslintConfig.ts","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":
|
2
|
+
,"/home/ladamczyk/Desktop/projects/qoq/packages/eslint-v9-ts-vitest/src/eslintConfig.ts": {"path":"/home/ladamczyk/Desktop/projects/qoq/packages/eslint-v9-ts-vitest/src/eslintConfig.ts","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":36}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":38}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":37}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":31}},"14":{"start":{"line":15,"column":0},"end":{"line":15,"column":24}},"15":{"start":{"line":16,"column":0},"end":{"line":16,"column":18}},"16":{"start":{"line":17,"column":0},"end":{"line":17,"column":66}},"17":{"start":{"line":18,"column":0},"end":{"line":18,"column":15}},"18":{"start":{"line":19,"column":0},"end":{"line":19,"column":15}},"19":{"start":{"line":20,"column":0},"end":{"line":20,"column":6}},"20":{"start":{"line":21,"column":0},"end":{"line":21,"column":46}},"21":{"start":{"line":22,"column":0},"end":{"line":22,"column":10}},"22":{"start":{"line":23,"column":0},"end":{"line":23,"column":12}},"23":{"start":{"line":24,"column":0},"end":{"line":24,"column":5}},"25":{"start":{"line":26,"column":0},"end":{"line":26,"column":91}},"26":{"start":{"line":27,"column":0},"end":{"line":27,"column":2}},"28":{"start":{"line":29,"column":0},"end":{"line":29,"column":33}}},"s":{"0":1,"1":1,"3":1,"7":1,"9":1,"14":1,"15":2,"16":2,"17":2,"18":2,"19":2,"20":2,"21":2,"22":2,"23":2,"25":2,"26":2,"28":1},"branchMap":{"0":{"type":"branch","line":15,"loc":{"start":{"line":15,"column":23},"end":{"line":27,"column":2}},"locations":[{"start":{"line":15,"column":23},"end":{"line":27,"column":2}}]},"1":{"type":"branch","line":26,"loc":{"start":{"line":26,"column":9},"end":{"line":26,"column":76}},"locations":[{"start":{"line":26,"column":9},"end":{"line":26,"column":76}}]}},"b":{"0":[2],"1":[0]},"fnMap":{"0":{"name":"getEslintConfig","decl":{"start":{"line":15,"column":23},"end":{"line":27,"column":2}},"loc":{"start":{"line":15,"column":23},"end":{"line":27,"column":2}},"line":15}},"f":{"0":2}}
|
3
3
|
}
|
@@ -25,28 +25,28 @@
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
26
26
|
<span class="strong">100% </span>
|
27
27
|
<span class="quiet">Statements</span>
|
28
|
-
<span class='fraction'>
|
28
|
+
<span class='fraction'>18/18</span>
|
29
29
|
</div>
|
30
30
|
|
31
31
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
33
|
-
<span class="strong">
|
33
|
+
<span class="strong">50% </span>
|
34
34
|
<span class="quiet">Branches</span>
|
35
|
-
<span class='fraction'>
|
35
|
+
<span class='fraction'>1/2</span>
|
36
36
|
</div>
|
37
37
|
|
38
38
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
40
40
|
<span class="strong">100% </span>
|
41
41
|
<span class="quiet">Functions</span>
|
42
|
-
<span class='fraction'>
|
42
|
+
<span class='fraction'>1/1</span>
|
43
43
|
</div>
|
44
44
|
|
45
45
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
47
47
|
<span class="strong">100% </span>
|
48
48
|
<span class="quiet">Lines</span>
|
49
|
-
<span class='fraction'>
|
49
|
+
<span class='fraction'>18/18</span>
|
50
50
|
</div>
|
51
51
|
|
52
52
|
|
@@ -81,8 +81,18 @@
|
|
81
81
|
<a name='L16'></a><a href='#L16'>16</a>
|
82
82
|
<a name='L17'></a><a href='#L17'>17</a>
|
83
83
|
<a name='L18'></a><a href='#L18'>18</a>
|
84
|
-
<a name='L19'></a><a href='#L19'>19</a
|
85
|
-
<
|
84
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
85
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
86
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
87
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
88
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
89
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
90
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
91
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
92
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
93
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
94
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
95
|
+
<a name='L30'></a><a href='#L30'>30</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
86
96
|
<span class="cline-any cline-yes">1x</span>
|
87
97
|
<span class="cline-any cline-neutral"> </span>
|
88
98
|
<span class="cline-any cline-yes">1x</span>
|
@@ -92,15 +102,26 @@
|
|
92
102
|
<span class="cline-any cline-yes">1x</span>
|
93
103
|
<span class="cline-any cline-neutral"> </span>
|
94
104
|
<span class="cline-any cline-yes">1x</span>
|
105
|
+
<span class="cline-any cline-neutral"> </span>
|
106
|
+
<span class="cline-any cline-neutral"> </span>
|
107
|
+
<span class="cline-any cline-neutral"> </span>
|
108
|
+
<span class="cline-any cline-neutral"> </span>
|
95
109
|
<span class="cline-any cline-yes">1x</span>
|
96
|
-
<span class="cline-any cline-yes">
|
97
|
-
<span class="cline-any cline-yes">
|
98
|
-
<span class="cline-any cline-yes">
|
99
|
-
<span class="cline-any cline-yes">
|
110
|
+
<span class="cline-any cline-yes">2x</span>
|
111
|
+
<span class="cline-any cline-yes">2x</span>
|
112
|
+
<span class="cline-any cline-yes">2x</span>
|
113
|
+
<span class="cline-any cline-yes">2x</span>
|
114
|
+
<span class="cline-any cline-yes">2x</span>
|
115
|
+
<span class="cline-any cline-yes">2x</span>
|
116
|
+
<span class="cline-any cline-yes">2x</span>
|
117
|
+
<span class="cline-any cline-yes">2x</span>
|
118
|
+
<span class="cline-any cline-yes">2x</span>
|
119
|
+
<span class="cline-any cline-neutral"> </span>
|
120
|
+
<span class="cline-any cline-yes">2x</span>
|
121
|
+
<span class="cline-any cline-yes">2x</span>
|
100
122
|
<span class="cline-any cline-neutral"> </span>
|
101
123
|
<span class="cline-any cline-yes">1x</span>
|
102
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import
|
103
|
-
|
124
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { includeIgnoreFile } from '@eslint/compat';
|
104
125
|
import merge from 'lodash/merge.js';
|
105
126
|
|
106
127
|
import baseConfig from './baseConfig';
|
@@ -109,14 +130,26 @@ import type { Linter } from 'eslint';
|
|
109
130
|
|
110
131
|
const filesExtensions = ['js', 'ts'];
|
111
132
|
|
112
|
-
const
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
133
|
+
export const getEslintConfig: (
|
134
|
+
srcPath?: string,
|
135
|
+
files?: string[],
|
136
|
+
ignores?: string[],
|
137
|
+
gitignorePath?: string
|
138
|
+
) => Linter.Config[] = (
|
139
|
+
srcPath = 'src',
|
140
|
+
files = [`${srcPath}/**/*.spec.{${filesExtensions.join(',')}}`],
|
141
|
+
ignores = [],
|
142
|
+
gitignorePath
|
143
|
+
) => {
|
144
|
+
const eslintConfig = merge({}, baseConfig, {
|
145
|
+
files,
|
146
|
+
ignores,
|
147
|
+
});
|
148
|
+
|
149
|
+
return <span class="branch-0 cbranch-no" title="branch not covered" >gitignorePath ? [includeIgnoreFile(gitignorePath), eslintConfig] : [</span>eslintConfig];
|
150
|
+
};
|
118
151
|
|
119
|
-
export default
|
152
|
+
export default getEslintConfig();
|
120
153
|
</pre></td></tr></table></pre>
|
121
154
|
|
122
155
|
<div class='push'></div><!-- for sticky footer -->
|
@@ -124,7 +157,7 @@ export default eslintConfig;
|
|
124
157
|
<div class='footer quiet pad2 space-top1 center small'>
|
125
158
|
Code coverage generated by
|
126
159
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
127
|
-
at 2024-
|
160
|
+
at 2024-09-06T07:21:47.149Z
|
128
161
|
</div>
|
129
162
|
<script src="prettify.js"></script>
|
130
163
|
<script>
|
package/coverage/index.html
CHANGED
@@ -25,28 +25,28 @@
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
26
26
|
<span class="strong">100% </span>
|
27
27
|
<span class="quiet">Statements</span>
|
28
|
-
<span class='fraction'>
|
28
|
+
<span class='fraction'>35/35</span>
|
29
29
|
</div>
|
30
30
|
|
31
31
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
33
|
-
<span class="strong">
|
33
|
+
<span class="strong">50% </span>
|
34
34
|
<span class="quiet">Branches</span>
|
35
|
-
<span class='fraction'>
|
35
|
+
<span class='fraction'>1/2</span>
|
36
36
|
</div>
|
37
37
|
|
38
38
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
40
40
|
<span class="strong">100% </span>
|
41
41
|
<span class="quiet">Functions</span>
|
42
|
-
<span class='fraction'>
|
42
|
+
<span class='fraction'>1/1</span>
|
43
43
|
</div>
|
44
44
|
|
45
45
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
47
47
|
<span class="strong">100% </span>
|
48
48
|
<span class="quiet">Lines</span>
|
49
|
-
<span class='fraction'>
|
49
|
+
<span class='fraction'>35/35</span>
|
50
50
|
</div>
|
51
51
|
|
52
52
|
|
@@ -99,13 +99,13 @@
|
|
99
99
|
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
100
100
|
</td>
|
101
101
|
<td data-value="100" class="pct high">100%</td>
|
102
|
-
<td data-value="
|
103
|
-
<td data-value="
|
104
|
-
<td data-value="
|
102
|
+
<td data-value="18" class="abs high">18/18</td>
|
103
|
+
<td data-value="50" class="pct medium">50%</td>
|
104
|
+
<td data-value="2" class="abs medium">1/2</td>
|
105
105
|
<td data-value="100" class="pct high">100%</td>
|
106
|
-
<td data-value="
|
106
|
+
<td data-value="1" class="abs high">1/1</td>
|
107
107
|
<td data-value="100" class="pct high">100%</td>
|
108
|
-
<td data-value="
|
108
|
+
<td data-value="18" class="abs high">18/18</td>
|
109
109
|
</tr>
|
110
110
|
|
111
111
|
</tbody>
|
@@ -116,7 +116,7 @@
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
117
117
|
Code coverage generated by
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
119
|
-
at 2024-
|
119
|
+
at 2024-09-06T07:21:47.149Z
|
120
120
|
</div>
|
121
121
|
<script src="prettify.js"></script>
|
122
122
|
<script>
|
package/lib/eslintConfig.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
1
|
import type { Linter } from 'eslint';
|
2
|
-
declare const
|
3
|
-
|
2
|
+
export declare const getEslintConfig: (srcPath?: string, files?: string[], ignores?: string[], gitignorePath?: string) => Linter.Config[];
|
3
|
+
declare const _default: Linter.Config<Linter.RulesRecord>[];
|
4
|
+
export default _default;
|
package/lib/eslintConfig.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var compat = require('@eslint/compat');
|
4
6
|
var merge = require('lodash/merge.js');
|
5
7
|
var baseConfig = require('./baseConfig.js');
|
6
8
|
require('@saashub/qoq-eslint-v9-js/tools');
|
@@ -9,11 +11,14 @@ require('@saashub/qoq-eslint-v9-js-vitest/baseConfig');
|
|
9
11
|
require('@saashub/qoq-eslint-v9-ts/baseConfig');
|
10
12
|
|
11
13
|
const filesExtensions = ['js', 'ts'];
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
})
|
17
|
-
];
|
14
|
+
const getEslintConfig = (srcPath = 'src', files = [`${srcPath}/**/*.spec.{${filesExtensions.join(',')}}`], ignores = [], gitignorePath) => {
|
15
|
+
const eslintConfig = merge({}, baseConfig, {
|
16
|
+
files,
|
17
|
+
ignores,
|
18
|
+
});
|
19
|
+
return gitignorePath ? [compat.includeIgnoreFile(gitignorePath), eslintConfig] : [eslintConfig];
|
20
|
+
};
|
21
|
+
var eslintConfig = getEslintConfig();
|
18
22
|
|
19
|
-
|
23
|
+
exports.default = eslintConfig;
|
24
|
+
exports.getEslintConfig = getEslintConfig;
|
package/lib/eslintConfig.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { includeIgnoreFile } from '@eslint/compat';
|
2
2
|
import merge from 'lodash/merge.js';
|
3
3
|
import config from './baseConfig.mjs';
|
4
4
|
import '@saashub/qoq-eslint-v9-js/tools';
|
@@ -7,11 +7,13 @@ import '@saashub/qoq-eslint-v9-js-vitest/baseConfig';
|
|
7
7
|
import '@saashub/qoq-eslint-v9-ts/baseConfig';
|
8
8
|
|
9
9
|
const filesExtensions = ['js', 'ts'];
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
})
|
15
|
-
];
|
10
|
+
const getEslintConfig = (srcPath = 'src', files = [`${srcPath}/**/*.spec.{${filesExtensions.join(',')}}`], ignores = [], gitignorePath) => {
|
11
|
+
const eslintConfig = merge({}, config, {
|
12
|
+
files,
|
13
|
+
ignores,
|
14
|
+
});
|
15
|
+
return gitignorePath ? [includeIgnoreFile(gitignorePath), eslintConfig] : [eslintConfig];
|
16
|
+
};
|
17
|
+
var eslintConfig = getEslintConfig();
|
16
18
|
|
17
|
-
export { eslintConfig as default };
|
19
|
+
export { eslintConfig as default, getEslintConfig };
|
package/lib/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
declare const _default: {
|
2
2
|
baseConfig: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>;
|
3
|
-
eslintConfig: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord
|
3
|
+
eslintConfig: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
|
4
4
|
};
|
5
5
|
export default _default;
|
package/lib/index.js
CHANGED
@@ -7,8 +7,8 @@ require('eslint-plugin-import');
|
|
7
7
|
require('@saashub/qoq-eslint-v9-js-vitest/baseConfig');
|
8
8
|
require('@saashub/qoq-eslint-v9-ts/baseConfig');
|
9
9
|
require('lodash/merge.js');
|
10
|
-
require('@
|
10
|
+
require('@eslint/compat');
|
11
11
|
|
12
|
-
var index = { baseConfig, eslintConfig };
|
12
|
+
var index = { baseConfig, eslintConfig: eslintConfig.default };
|
13
13
|
|
14
14
|
module.exports = index;
|
package/lib/index.mjs
CHANGED
@@ -5,7 +5,7 @@ import 'eslint-plugin-import';
|
|
5
5
|
import '@saashub/qoq-eslint-v9-js-vitest/baseConfig';
|
6
6
|
import '@saashub/qoq-eslint-v9-ts/baseConfig';
|
7
7
|
import 'lodash/merge.js';
|
8
|
-
import '@
|
8
|
+
import '@eslint/compat';
|
9
9
|
|
10
10
|
var index = { baseConfig: config, eslintConfig };
|
11
11
|
|
package/package.json
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@saashub/qoq-eslint-v9-ts-vitest",
|
3
3
|
"description": "Eslint flat config template for TS + Vitest",
|
4
|
+
"type": "module",
|
4
5
|
"license": "MIT",
|
5
|
-
"version": "0.7.
|
6
|
+
"version": "0.7.9",
|
6
7
|
"main": "./lib/index.js",
|
7
8
|
"module": "./lib/index.mjs",
|
8
9
|
"types": "./lib/index.d.js",
|
@@ -38,8 +39,8 @@
|
|
38
39
|
"inspect": "npm run build && eslint -c ./lib/eslintConfig.js --inspect-config"
|
39
40
|
},
|
40
41
|
"dependencies": {
|
41
|
-
"@saashub/qoq-eslint-v9-js-vitest": "^0.7.
|
42
|
-
"@saashub/qoq-eslint-v9-ts": "^0.7.
|
42
|
+
"@saashub/qoq-eslint-v9-js-vitest": "^0.7.9",
|
43
|
+
"@saashub/qoq-eslint-v9-ts": "^0.7.9",
|
43
44
|
"lodash": "4.17.21"
|
44
45
|
},
|
45
46
|
"devDependencies": {
|
@@ -47,7 +48,7 @@
|
|
47
48
|
"@types/eslint": "^9",
|
48
49
|
"@types/lodash": "4.17.7",
|
49
50
|
"rimraf": "6.0.1",
|
50
|
-
"rollup": "4.21.
|
51
|
+
"rollup": "4.21.2",
|
51
52
|
"typescript": "5.5.4",
|
52
53
|
"vitest": "2.0.5"
|
53
54
|
},
|
@@ -67,5 +68,5 @@
|
|
67
68
|
"directory": "packages/eslint-v9-ts-vitest"
|
68
69
|
},
|
69
70
|
"homepage": "https://github.com/saashub-it/qoq/tree/master/packages/eslint-v9-ts-vitest",
|
70
|
-
"gitHead": "
|
71
|
+
"gitHead": "5c1db9e7ecbe34df852a19bf0ce6684280d94e87"
|
71
72
|
}
|
package/rollup.config.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
1
|
+
import config from '../../rollup.eslint.config.js';
|
2
2
|
|
3
|
-
|
3
|
+
export default config;
|
package/src/eslintConfig.spec.ts
CHANGED
@@ -2,14 +2,14 @@ import { describe, test, expect } from 'vitest';
|
|
2
2
|
import { execSync } from 'child_process';
|
3
3
|
import { ESLint } from 'eslint';
|
4
4
|
|
5
|
-
import
|
5
|
+
import { getEslintConfig } from './eslintConfig';
|
6
6
|
|
7
7
|
describe('baseConfig', () => {
|
8
8
|
test('can constuct Eslint object', () => {
|
9
9
|
expect(
|
10
10
|
() =>
|
11
11
|
new ESLint({
|
12
|
-
baseConfig:
|
12
|
+
baseConfig: getEslintConfig(),
|
13
13
|
})
|
14
14
|
).not.toThrowError();
|
15
15
|
});
|
@@ -18,7 +18,7 @@ describe('baseConfig', () => {
|
|
18
18
|
const projectPath = __dirname.replace('/src', '');
|
19
19
|
|
20
20
|
expect(() =>
|
21
|
-
execSync(`eslint ${projectPath}/lib/index.js -c ${projectPath}/lib/eslintConfig.
|
21
|
+
execSync(`eslint ${projectPath}/lib/index.js -c ${projectPath}/lib/eslintConfig.mjs`)
|
22
22
|
).not.toThrowError();
|
23
23
|
});
|
24
24
|
});
|
package/src/eslintConfig.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import { includeIgnoreFile } from '@eslint/compat';
|
3
2
|
import merge from 'lodash/merge.js';
|
4
3
|
|
5
4
|
import baseConfig from './baseConfig';
|
@@ -8,11 +7,23 @@ import type { Linter } from 'eslint';
|
|
8
7
|
|
9
8
|
const filesExtensions = ['js', 'ts'];
|
10
9
|
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
export const getEslintConfig: (
|
11
|
+
srcPath?: string,
|
12
|
+
files?: string[],
|
13
|
+
ignores?: string[],
|
14
|
+
gitignorePath?: string
|
15
|
+
) => Linter.Config[] = (
|
16
|
+
srcPath = 'src',
|
17
|
+
files = [`${srcPath}/**/*.spec.{${filesExtensions.join(',')}}`],
|
18
|
+
ignores = [],
|
19
|
+
gitignorePath
|
20
|
+
) => {
|
21
|
+
const eslintConfig = merge({}, baseConfig, {
|
22
|
+
files,
|
23
|
+
ignores,
|
24
|
+
});
|
25
|
+
|
26
|
+
return gitignorePath ? [includeIgnoreFile(gitignorePath), eslintConfig] : [eslintConfig];
|
27
|
+
};
|
17
28
|
|
18
|
-
export default
|
29
|
+
export default getEslintConfig();
|