-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: @putout/plugin-putout-config: apply-parens
- Loading branch information
1 parent
f64bb95
commit 5b39158
Showing
15 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/plugin-putout-config/lib/apply-esm/fixture/apply-esm-fix.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
__putout_processor_json({ | ||
"rules": { | ||
"esm/remove-empty-import": "on", | ||
"esm/remove-empty-export": "on", | ||
"esm/group-imports-by-source": "on", | ||
"esm/declare-imports-first": "on", | ||
"esm/remove-quotes-from-import-assertions": "on", | ||
"esm/merge-duplicate-imports": "on" | ||
} | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/plugin-putout-config/lib/apply-esm/fixture/apply-esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
__putout_processor_json({ | ||
"rules": { | ||
"remove-empty/import": "on", | ||
"remove-empty/export": "on", | ||
"group-imports-by-source": "on", | ||
"declare-imports-first": "on", | ||
"remove-quotes-from-import-assertions": "on", | ||
"merge-duplicate-imports": "on" | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
const {createRenameProperty} = require('../rename-property'); | ||
|
||
const v37 = [ | ||
['remove-empty/import', 'esm/remove-empty-import'], | ||
['remove-empty/export', 'esm/remove-empty-export'], | ||
['group-imports-by-source', 'esm/group-imports-by-source'], | ||
['declare-imports-first', 'esm/declare-imports-first'], | ||
['remove-quotes-from-import-assertions', 'esm/remove-quotes-from-import-assertions'], | ||
['merge-duplicate-imports', 'esm/merge-duplicate-imports'], | ||
]; | ||
|
||
module.exports = createRenameProperty(v37); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const {createTest} = require('@putout/test'); | ||
const plugin = require('.'); | ||
|
||
const test = createTest(__dirname, { | ||
printer: 'putout', | ||
plugins: [ | ||
['apply-esm', plugin], | ||
], | ||
}); | ||
|
||
test('putout-config: apply-esm: report', (t) => { | ||
t.report('apply-esm', `Rename property: 'remove-empty/import' -> 'esm/remove-empty-import'`); | ||
t.end(); | ||
}); | ||
|
||
test('putout-config: apply-esm: transform', (t) => { | ||
t.transform('apply-esm'); | ||
t.end(); | ||
}); | ||
|
5 changes: 5 additions & 0 deletions
5
packages/plugin-putout-config/lib/apply-parens/fixture/apply-parens-fix.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__putout_processor_json({ | ||
"rules": { | ||
"parens/add-missing": "on" | ||
} | ||
}); |
5 changes: 5 additions & 0 deletions
5
packages/plugin-putout-config/lib/apply-parens/fixture/apply-parens.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__putout_processor_json({ | ||
"rules": { | ||
"add-missing-parens": "on" | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
const {createRenameProperty} = require('../rename-property'); | ||
|
||
const v37 = [ | ||
['add-missing-parens', 'parens/add-missing'], | ||
]; | ||
|
||
module.exports = createRenameProperty(v37); |
21 changes: 21 additions & 0 deletions
21
packages/plugin-putout-config/lib/apply-parens/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const {createTest} = require('@putout/test'); | ||
const plugin = require('.'); | ||
|
||
const test = createTest(__dirname, { | ||
plugins: [ | ||
['apply-parens', plugin], | ||
], | ||
}); | ||
|
||
test('putout-config: apply-parens: report', (t) => { | ||
t.report('apply-parens', `Rename property: 'add-missing-parens' -> 'parens/add-missing'`); | ||
t.end(); | ||
}); | ||
|
||
test('putout-config: apply-parens: transform', (t) => { | ||
t.transform('apply-parens'); | ||
t.end(); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/plugin-putout-config/test/fixture/apply-esm-fix.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
__putout_processor_json({ | ||
"rules": { | ||
"esm/remove-empty-import": "on", | ||
"esm/remove-empty-export": "on", | ||
"esm/group-imports-by-source": "on", | ||
"esm/declare-imports-first": "on", | ||
"esm/remove-quotes-from-import-assertions": "on", | ||
"esm/merge-duplicate-imports": "on" | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
__putout_processor_json({ | ||
"rules": { | ||
"remove-empty/import": "on", | ||
"remove-empty/export": "on", | ||
"group-imports-by-source": "on", | ||
"declare-imports-first": "on", | ||
"remove-quotes-from-import-assertions": "on", | ||
"merge-duplicate-imports": "on" | ||
} | ||
}); |
5 changes: 5 additions & 0 deletions
5
packages/plugin-putout-config/test/fixture/apply-parens-fix.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__putout_processor_json({ | ||
"rules": { | ||
"parens/add-missing": "on" | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__putout_processor_json({ | ||
"rules": { | ||
"add-missing-parens": "on" | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters