File tree Expand file tree Collapse file tree 15 files changed +48
-70
lines changed
remove-useless-for-params Expand file tree Collapse file tree 15 files changed +48
-70
lines changed File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1- 'use strict ';
1+ import { types , operator } from 'putout ';
22
3- const { types, operator} = require ( 'putout' ) ;
43const {
54 unaryExpression,
65 binaryExpression,
@@ -13,9 +12,9 @@ const {
1312
1413const { replaceWith, addParens} = operator ;
1514
16- module . exports . report = ( ) => `SyntaxError: Invalid left-hand side in assignment expression` ;
15+ export const report = ( ) => `SyntaxError: Invalid left-hand side in assignment expression` ;
1716
18- module . exports . fix = ( path ) => {
17+ export const fix = ( path ) => {
1918 const {
2019 left,
2120 right,
@@ -53,7 +52,7 @@ module.exports.fix = (path) => {
5352 addParens ( path ) ;
5453} ;
5554
56- module . exports . traverse = ( { push} ) => ( {
55+ export const traverse = ( { push} ) => ( {
5756 AssignmentExpression ( path ) {
5857 if ( isLogicalExpression ( path . node . left ) )
5958 push ( path ) ;
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ import { createTest } from '@putout/test' ;
2+ import * as plugin from './index.js' ;
23
3- const { createTest} = require ( '@putout/test' ) ;
4- const plugin = require ( '.' ) ;
5-
6- const test = createTest ( __dirname , {
4+ const test = createTest ( import . meta. url , {
75 plugins : [
86 [ 'add-missing-for-assign' , plugin ] ,
97 ] ,
Original file line number Diff line number Diff line change 1- 'use strict' ;
2-
3- const {
1+ import {
42 print ,
53 types ,
64 operator ,
7- } = require ( 'putout' ) ;
5+ } from 'putout' ;
86
97const { awaitExpression} = types ;
108const { replaceWith, addParens} = operator ;
119
12- module . exports . report = ( path ) => {
10+ export const report = ( path ) => {
1311 const line = print ( path . get ( 'argument.callee' ) ) ;
1412 return `TypeError: '${ line } ' is not a function` ;
1513} ;
1614
17- module . exports . fix = ( path ) => {
15+ export const fix = ( path ) => {
1816 const { argument} = path . node ;
1917 const newPath = replaceWith ( path , argument ) ;
2018 const objectPath = newPath . get ( 'expression.callee.object' ) ;
@@ -24,7 +22,7 @@ module.exports.fix = (path) => {
2422 addParens ( path ) ;
2523} ;
2624
27- module . exports . traverse = ( { push} ) => ( {
25+ export const traverse = ( { push} ) => ( {
2826 AwaitExpression ( path ) {
2927 const argPath = path . get ( 'argument' ) ;
3028
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ import { createTest } from '@putout/test' ;
2+ import * as plugin from './index.js' ;
23
3- const { createTest} = require ( '@putout/test' ) ;
4- const plugin = require ( '.' ) ;
5-
6- const test = createTest ( __dirname , {
4+ const test = createTest ( import . meta. url , {
75 plugins : [
86 [ 'add-missing-for-await' , plugin ] ,
97 ] ,
Original file line number Diff line number Diff line change 1- 'use strict ';
1+ import { operator } from 'putout ';
22
3- const { operator} = require ( 'putout' ) ;
43const { addParens} = operator ;
54
6- module . exports . report = ( ) => `Add missing parens: invalid tagged template on optional chain` ;
5+ export const report = ( ) => `Add missing parens: invalid tagged template on optional chain` ;
76
8- module . exports . fix = ( path ) => {
7+ export const fix = ( path ) => {
98 addParens ( path ) ;
109} ;
1110
12- module . exports . traverse = ( { push} ) => ( {
11+ export const traverse = ( { push} ) => ( {
1312 TaggedTemplateExpression ( path ) {
1413 const tagPath = path . get ( 'tag' ) ;
1514
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ import { createTest } from '@putout/test' ;
2+ import * as plugin from './index.js' ;
23
3- const { createTest} = require ( '@putout/test' ) ;
4- const plugin = require ( '.' ) ;
5-
6- const test = createTest ( __dirname , {
4+ const test = createTest ( import . meta. url , {
75 plugins : [
86 [ 'add-missing-for-template' , plugin ] ,
97 ] ,
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ import * as addMissingForAwait from './add-missing-for-await/index.js' ;
2+ import * as addMissingForTemplate from './add-missing-for-template/index.js' ;
3+ import * as addMissingForAssign from './add-missing-for-assign/index.js' ;
4+ import * as removeUselessForAwait from './remove-useless-for-await/index.js' ;
5+ import * as removeUselessForParams from './remove-useless-for-params/index.js' ;
26
3- const addMissingForAwait = require ( './add-missing-for-await' ) ;
4- const addMissingForTemplate = require ( './add-missing-for-template' ) ;
5- const addMissingForAssign = require ( './add-missing-for-assign' ) ;
6- const removeUselessForAwait = require ( './remove-useless-for-await' ) ;
7- const removeUselessForParams = require ( './remove-useless-for-params' ) ;
8-
9- module . exports . rules = {
7+ export const rules = {
108 'add-missing-for-awai' : addMissingForAwait ,
119 'add-missing-for-template' : addMissingForTemplate ,
1210 'add-missing-for-assign' : addMissingForAssign ,
Original file line number Diff line number Diff line change 1- 'use strict ';
1+ import { operator } from 'putout ';
22
3- const { operator} = require ( 'putout' ) ;
43const { hasParens} = operator ;
54
6- module . exports . report = ( ) => `Remove useless parens around 'await'` ;
5+ export const report = ( ) => `Remove useless parens around 'await'` ;
76
8- module . exports . fix = ( path ) => {
7+ export const fix = ( path ) => {
98 path . node . extra = {
109 parenthesized : false ,
1110 } ;
1211} ;
1312
14- module . exports . traverse = ( { push} ) => ( {
13+ export const traverse = ( { push} ) => ( {
1514 AwaitExpression ( path ) {
1615 if ( ! hasParens ( path ) )
1716 return ;
You can’t perform that action at this time.
0 commit comments