@putout/operator-match-files 11.0.0 → 11.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/README.md +26 -1
- package/lib/match-files.js +5 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -126,9 +126,34 @@ You can also pass `options`:
|
|
|
126
126
|
module.exports = matchFiles({
|
|
127
127
|
'.eslintrc.json -> eslint.config.js': {
|
|
128
128
|
rules: {
|
|
129
|
-
'eslint/declare': {
|
|
129
|
+
'eslint/declare': ['on', {
|
|
130
130
|
type: 'esm',
|
|
131
|
+
}],
|
|
132
|
+
},
|
|
133
|
+
plugins: [
|
|
134
|
+
['eslint/convert-rc-to-flat', rcToFlat],
|
|
135
|
+
['eslint/declare', declare],
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Printer Options
|
|
142
|
+
|
|
143
|
+
You can also pass [`printer options`](https://github.com/putoutjs/printer?tab=readme-ov-file#overrides):
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
module.exports = matchFiles({
|
|
147
|
+
'.eslintrc.json -> eslint.config.js': {
|
|
148
|
+
printer: ['putout', {
|
|
149
|
+
format: {
|
|
150
|
+
indent: ' ',
|
|
131
151
|
},
|
|
152
|
+
}],
|
|
153
|
+
rules: {
|
|
154
|
+
'eslint/declare': ['on', {
|
|
155
|
+
type: 'esm',
|
|
156
|
+
}],
|
|
132
157
|
},
|
|
133
158
|
plugins: [
|
|
134
159
|
['eslint/convert-rc-to-flat', rcToFlat],
|
package/lib/match-files.js
CHANGED
|
@@ -40,10 +40,10 @@ export const matchFiles = (options) => {
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
function fix(inputFile, {dirPath, matchInputFilename, outputFilename, matchedJS, matchedAST, options}) {
|
|
43
|
+
function fix(inputFile, {dirPath, matchInputFilename, outputFilename, matchedJS, matchedAST, options, rawOptions}) {
|
|
44
44
|
transform(matchedAST, matchedJS, options);
|
|
45
45
|
|
|
46
|
-
const matchedJSON = magicPrint(outputFilename, matchedAST);
|
|
46
|
+
const matchedJSON = magicPrint(outputFilename, matchedAST, rawOptions);
|
|
47
47
|
const outputFile = getOutputFile({
|
|
48
48
|
dirPath,
|
|
49
49
|
matchInputFilename,
|
|
@@ -124,6 +124,7 @@ const createScan = ({files, exclude, defaultFilename}) => (mainPath, {push, prog
|
|
|
124
124
|
outputFilename,
|
|
125
125
|
message,
|
|
126
126
|
options,
|
|
127
|
+
rawOptions,
|
|
127
128
|
|
|
128
129
|
matchedAST,
|
|
129
130
|
matchedJS,
|
|
@@ -150,9 +151,9 @@ function magicParse(name, content) {
|
|
|
150
151
|
return [content, parse(content)];
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
function magicPrint(name, ast) {
|
|
154
|
+
function magicPrint(name, ast, options) {
|
|
154
155
|
if (name.endsWith('.json')) {
|
|
155
|
-
const js = print(ast);
|
|
156
|
+
const js = print(ast, options);
|
|
156
157
|
|
|
157
158
|
return fromJS(js);
|
|
158
159
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/operator-match-files",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout operator adds ability to match files to plugins",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@putout/babel": "^5.0.0",
|
|
28
28
|
"@putout/engine-parser": "^15.0.1",
|
|
29
29
|
"@putout/operator-filesystem": "^10.0.0",
|
|
30
|
-
"@putout/operator-json": "^
|
|
30
|
+
"@putout/operator-json": "^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"putout",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"match-files"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@putout/eslint-flat": "^
|
|
39
|
+
"@putout/eslint-flat": "^4.0.0",
|
|
40
40
|
"@putout/plugin-nodejs": "*",
|
|
41
41
|
"@putout/test": "^15.0.0",
|
|
42
42
|
"c8": "^10.0.0",
|
|
43
43
|
"eslint": "^10.0.0-alpha.0",
|
|
44
|
-
"eslint-plugin-putout": "^
|
|
44
|
+
"eslint-plugin-putout": "^30.0.0",
|
|
45
45
|
"madrun": "^12.0.0",
|
|
46
46
|
"montag": "^1.2.1",
|
|
47
47
|
"nodemon": "^3.0.1",
|