File tree Expand file tree Collapse file tree 16 files changed +65
-89
lines changed
packages/plugin-react-hook-form
v5-remove-value-from-control
v6-convert-form-context-to-form-provider
v6-convert-trigger-validation-to-trigger Expand file tree Collapse file tree 16 files changed +65
-89
lines changed Original file line number Diff line number Diff line change 1+ import * as v7ApplyFormState from './v7-apply-form-state/index.js' ;
2+ import * as v6ApplyClearErrors from './v6-apply-clear-errors/index.js' ;
3+ import * as v6ConvertAsToRender from './v6-convert-as-to-render/index.js' ;
4+ import * as v6ConvertFormContextToFormProvider from './v6-convert-form-context-to-form-provider/index.js' ;
5+ import * as v6ConvertTriggerValidationToTrigger from './v6-convert-trigger-validation-to-trigger/index.js' ;
6+ import * as v5RemoveValueFromControl from './v5-remove-value-from-control/index.js' ;
7+
8+ export const rules = {
9+ 'v7-apply-form-state' : v7ApplyFormState ,
10+ 'v6-apply-clear-errors' : v6ApplyClearErrors ,
11+ 'v6-convert-as-to-render' : v6ConvertAsToRender ,
12+ 'v6-convert-form-context-to-form-provider' : v6ConvertFormContextToFormProvider ,
13+ 'v6-convert-trigger-validation-to-trigger' : v6ConvertTriggerValidationToTrigger ,
14+ 'v5-remove-value-from-control' : v5RemoveValueFromControl ,
15+ } ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ export const report = ( ) => `Remove 'value property' from 'control' attribute` ;
22
3- module . exports . report = ( ) => `Remove 'value property' from 'control' attribute` ;
4-
5- module . exports . match = ( ) => ( {
3+ export const match = ( ) => ( {
64 '({value: __a})' : ( vars , path ) => {
75 if ( ! path . parentPath . parentPath . isJSXExpressionContainer ( ) )
86 return false ;
@@ -16,6 +14,6 @@ module.exports.match = () => ({
1614 } ,
1715} ) ;
1816
19- module . exports . replace = ( ) => ( {
17+ export const replace = ( ) => ( {
2018 '({value: __a})' : '__a' ,
2119} ) ;
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ import { createTest } from '@putout/test' ;
2+ import * as removeValueFromControl from './index.js' ;
23
3- const { createTest} = require ( '@putout/test' ) ;
4- const removeValueFromControl = require ( '.' ) ;
5-
6- const test = createTest ( __dirname , {
4+ const test = createTest ( import . meta. url , {
75 plugins : [
86 [ 'remove-value-from-control' , removeValueFromControl ] ,
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 { rename} = operator ;
54
6- module . exports . report = ( ) => `Use 'clearErrors' instead of 'clearError'` ;
5+ export const report = ( ) => `Use 'clearErrors' instead of 'clearError'` ;
76
8- module . exports . fix = ( path ) => {
7+ export const fix = ( path ) => {
98 const program = path . scope . getProgramParent ( ) . path ;
109 rename ( program , 'clearError' , 'clearErrors' ) ;
1110} ;
1211
13- module . exports . include = ( ) => [
12+ export const include = ( ) => [
1413 'clearError(__args)' ,
1514] ;
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ import { createTest } from '@putout/test' ;
2+ import * as applyClearErrors from './index.js' ;
23
3- const { createTest} = require ( '@putout/test' ) ;
4- const applyClearErrors = require ( '.' ) ;
5-
6- const test = createTest ( __dirname , {
4+ const test = createTest ( import . meta. url , {
75 plugins : [
86 [ 'apply-clear-errors' , applyClearErrors ] ,
97 ] ,
Original file line number Diff line number Diff line change 1- 'use strict' ;
2-
3- const { types, template} = require ( 'putout' ) ;
1+ import { types , template } from 'putout' ;
42
53const {
64 JSXExpressionContainer,
@@ -15,9 +13,9 @@ const ARROW = template(`({field}) => {
1513 return (%%expression%%);
1614}` ) ;
1715
18- module . exports . report = ( ) => `Use 'render' instead of 'as' in '<Control/>' elements` ;
16+ export const report = ( ) => `Use 'render' instead of 'as' in '<Control/>' elements` ;
1917
20- module . exports . match = ( ) => ( {
18+ export const match = ( ) => ( {
2119 '<Controller __jsx_attributes/>' : ( { __jsx_attributes} ) => {
2220 for ( const attr of __jsx_attributes ) {
2321 if ( isJSXSpreadAttribute ( attr ) )
@@ -31,7 +29,7 @@ module.exports.match = () => ({
3129 } ,
3230} ) ;
3331
34- module . exports . replace = ( ) => ( {
32+ export const replace = ( ) => ( {
3533 [ `
3634 <Controller
3735 as={__a}
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ import { createTest } from '@putout/test' ;
2+ import * as convertAsToRender from './index.js' ;
23
3- const { createTest} = require ( '@putout/test' ) ;
4- const convertAsToRender = require ( '.' ) ;
5-
6- const test = createTest ( __dirname , {
4+ const test = createTest ( import . meta. url , {
75 plugins : [
86 [ 'convert-as-to-render' , convertAsToRender ] ,
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 { rename} = operator ;
54
6- module . exports . report = ( ) => `Use '<FormProvider/>' instead of '<FormContext/>'` ;
5+ export const report = ( ) => `Use '<FormProvider/>' instead of '<FormContext/>'` ;
76
8- module . exports . fix = ( path ) => {
7+ export const fix = ( path ) => {
98 rename ( path , 'FormContext' , 'FormProvider' ) ;
109} ;
1110
12- module . exports . include = ( ) => [
11+ export const include = ( ) => [
1312 '<FormContext __jsx_attributes>__jsx_children</FormContext>' ,
1413] ;
1514
16- module . exports . filter = ( path ) => path . scope . getAllBindings ( ) . FormContext ;
15+ export const filter = ( path ) => path . scope . getAllBindings ( ) . FormContext ;
Original file line number Diff line number Diff line change 1- 'use strict' ;
1+ import { createTest } from '@putout/test' ;
2+ import * as convert from './index.js' ;
23
3- const { createTest} = require ( '@putout/test' ) ;
4- const convert = require ( '.' ) ;
5-
6- const test = createTest ( __dirname , {
4+ const test = createTest ( import . meta. url , {
75 plugins : [
86 [ 'v6-convert-form-context-to-form-provider' , convert ] ,
97 ] ,
You can’t perform that action at this time.
0 commit comments