diff --git a/src/rules/arrayStyle/index.js b/src/rules/arrayStyle/index.js index 6e5e1f0..31c758d 100644 --- a/src/rules/arrayStyle/index.js +++ b/src/rules/arrayStyle/index.js @@ -81,7 +81,7 @@ export default (defaultConfig, simpleType) => { create, meta: { fixable: 'code', + schema, }, - schema, }; }; diff --git a/src/rules/arrowParens.js b/src/rules/arrowParens.js index 0411f27..d80d67c 100644 --- a/src/rules/arrowParens.js +++ b/src/rules/arrowParens.js @@ -155,21 +155,21 @@ export default { }, type: 'layout', - }, - schema: [ - { - enum: ['always', 'as-needed'], - }, - { - additionalProperties: false, - properties: { - requireForBlockBody: { - default: false, - type: 'boolean', + schema: [ + { + enum: ['always', 'as-needed'], + }, + { + additionalProperties: false, + properties: { + requireForBlockBody: { + default: false, + type: 'boolean', + }, }, + type: 'object', }, - type: 'object', - }, - ], + ], + }, }; diff --git a/src/rules/booleanStyle.js b/src/rules/booleanStyle.js index be22566..3bd06fe 100644 --- a/src/rules/booleanStyle.js +++ b/src/rules/booleanStyle.js @@ -39,6 +39,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/defineFlowType.js b/src/rules/defineFlowType.js index 7a3b3c8..5ae03c7 100644 --- a/src/rules/defineFlowType.js +++ b/src/rules/defineFlowType.js @@ -91,5 +91,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/delimiterDangle.js b/src/rules/delimiterDangle.js index 8652470..5d2ae5d 100644 --- a/src/rules/delimiterDangle.js +++ b/src/rules/delimiterDangle.js @@ -129,6 +129,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/enforceLineBreak.js b/src/rules/enforceLineBreak.js index 59e8a41..310d70d 100644 --- a/src/rules/enforceLineBreak.js +++ b/src/rules/enforceLineBreak.js @@ -61,6 +61,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/enforceSuppressionCode.js b/src/rules/enforceSuppressionCode.js index f718f9e..187d9e5 100644 --- a/src/rules/enforceSuppressionCode.js +++ b/src/rules/enforceSuppressionCode.js @@ -48,5 +48,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/genericSpacing.js b/src/rules/genericSpacing.js index aa9004b..3b3f851 100644 --- a/src/rules/genericSpacing.js +++ b/src/rules/genericSpacing.js @@ -92,12 +92,10 @@ const create = (context) => { }; }; -const meta = { - fixable: 'whitespace', -}; - export default { create, - meta, - schema, + meta: { + fixable: 'whitespace', + schema, + }, }; diff --git a/src/rules/interfaceIdMatch.js b/src/rules/interfaceIdMatch.js index c28afcf..f1c761f 100644 --- a/src/rules/interfaceIdMatch.js +++ b/src/rules/interfaceIdMatch.js @@ -29,5 +29,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/newlineAfterFlowAnnotation.js b/src/rules/newlineAfterFlowAnnotation.js index 3cb7387..8b3fd6f 100644 --- a/src/rules/newlineAfterFlowAnnotation.js +++ b/src/rules/newlineAfterFlowAnnotation.js @@ -67,6 +67,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/noDupeKeys.js b/src/rules/noDupeKeys.js index 318f004..22f0907 100644 --- a/src/rules/noDupeKeys.js +++ b/src/rules/noDupeKeys.js @@ -90,5 +90,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/noFlowFixMeComments.js b/src/rules/noFlowFixMeComments.js index 1b9da04..48aba04 100644 --- a/src/rules/noFlowFixMeComments.js +++ b/src/rules/noFlowFixMeComments.js @@ -56,5 +56,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/noFlowSuppressionsInStrictFiles.js b/src/rules/noFlowSuppressionsInStrictFiles.js index 6b52c5a..c65d0ed 100644 --- a/src/rules/noFlowSuppressionsInStrictFiles.js +++ b/src/rules/noFlowSuppressionsInStrictFiles.js @@ -61,5 +61,7 @@ const create: Rule$Create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/noMixed.js b/src/rules/noMixed.js index d072005..876712a 100644 --- a/src/rules/noMixed.js +++ b/src/rules/noMixed.js @@ -11,5 +11,7 @@ const create = (context) => ({ export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/noMutableArray.js b/src/rules/noMutableArray.js index 4f6cac7..c1a804a 100644 --- a/src/rules/noMutableArray.js +++ b/src/rules/noMutableArray.js @@ -56,6 +56,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/noPrimitiveConstructorTypes.js b/src/rules/noPrimitiveConstructorTypes.js index a649263..17505f9 100644 --- a/src/rules/noPrimitiveConstructorTypes.js +++ b/src/rules/noPrimitiveConstructorTypes.js @@ -25,5 +25,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/noTypesMissingFileAnnotation.js b/src/rules/noTypesMissingFileAnnotation.js index 4f28c64..e6e5639 100644 --- a/src/rules/noTypesMissingFileAnnotation.js +++ b/src/rules/noTypesMissingFileAnnotation.js @@ -50,5 +50,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/noWeakTypes.js b/src/rules/noWeakTypes.js index 851066f..1918b31 100644 --- a/src/rules/noWeakTypes.js +++ b/src/rules/noWeakTypes.js @@ -77,5 +77,7 @@ const create: Rule$Create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/objectTypeCurlySpacing.js b/src/rules/objectTypeCurlySpacing.js index c94ee32..b10d8b2 100644 --- a/src/rules/objectTypeCurlySpacing.js +++ b/src/rules/objectTypeCurlySpacing.js @@ -9,10 +9,6 @@ const schema = [ }, ]; -const meta = { - fixable: 'code', -}; - const sameLine = (left, right) => left.loc.end.line === right.loc.start.line; const create = (context) => { @@ -86,6 +82,8 @@ const create = (context) => { export default { create, - meta, - schema, + meta: { + fixable: 'code', + schema, + }, }; diff --git a/src/rules/objectTypeDelimiter.js b/src/rules/objectTypeDelimiter.js index 9f02df6..fd54497 100644 --- a/src/rules/objectTypeDelimiter.js +++ b/src/rules/objectTypeDelimiter.js @@ -66,6 +66,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/quotes.js b/src/rules/quotes.js index e66f259..af6f90d 100644 --- a/src/rules/quotes.js +++ b/src/rules/quotes.js @@ -5,10 +5,6 @@ const schema = [ }, ]; -const meta = { - fixable: 'code', -}; - const create = (context) => { const double = (context.options[0] || 'double') === 'double'; const sourceCode = context.getSourceCode(); @@ -42,6 +38,8 @@ const create = (context) => { export default { create, - meta, - schema, + meta: { + fixable: 'code', + schema, + }, }; diff --git a/src/rules/requireCompoundTypeAlias.js b/src/rules/requireCompoundTypeAlias.js index 7ef34e0..fe58b56 100644 --- a/src/rules/requireCompoundTypeAlias.js +++ b/src/rules/requireCompoundTypeAlias.js @@ -67,5 +67,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/requireExactType.js b/src/rules/requireExactType.js index 66e6507..ea2f419 100644 --- a/src/rules/requireExactType.js +++ b/src/rules/requireExactType.js @@ -5,10 +5,6 @@ const schema = [ }, ]; -const meta = { - fixable: 'code', -}; - const create = (context) => { const always = (context.options[0] || 'always') === 'always'; const sourceCode = context.getSourceCode(); @@ -48,6 +44,8 @@ const create = (context) => { export default { create, - meta, - schema, + meta: { + fixable: 'code', + schema, + }, }; diff --git a/src/rules/requireIndexerName.js b/src/rules/requireIndexerName.js index cb54f60..96d8551 100644 --- a/src/rules/requireIndexerName.js +++ b/src/rules/requireIndexerName.js @@ -37,6 +37,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/requireInexactType.js b/src/rules/requireInexactType.js index aa0f0b0..988a86f 100644 --- a/src/rules/requireInexactType.js +++ b/src/rules/requireInexactType.js @@ -37,5 +37,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/requireParameterType.js b/src/rules/requireParameterType.js index 50c30b2..7b61d11 100644 --- a/src/rules/requireParameterType.js +++ b/src/rules/requireParameterType.js @@ -73,5 +73,7 @@ const create = iterateFunctionNodes((context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/requireReadonlyReactProps.js b/src/rules/requireReadonlyReactProps.js index 960f642..1283098 100644 --- a/src/rules/requireReadonlyReactProps.js +++ b/src/rules/requireReadonlyReactProps.js @@ -185,5 +185,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/requireReturnType.js b/src/rules/requireReturnType.js index bf09171..aa3b241 100644 --- a/src/rules/requireReturnType.js +++ b/src/rules/requireReturnType.js @@ -161,5 +161,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/requireTypesAtTop.js b/src/rules/requireTypesAtTop.js index bccea43..e9323d4 100644 --- a/src/rules/requireTypesAtTop.js +++ b/src/rules/requireTypesAtTop.js @@ -72,5 +72,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/requireValidFileAnnotation.js b/src/rules/requireValidFileAnnotation.js index d0d4f25..ba1635d 100644 --- a/src/rules/requireValidFileAnnotation.js +++ b/src/rules/requireValidFileAnnotation.js @@ -151,6 +151,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/requireVariableType.js b/src/rules/requireVariableType.js index 009106f..17052e5 100644 --- a/src/rules/requireVariableType.js +++ b/src/rules/requireVariableType.js @@ -76,5 +76,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/semi.js b/src/rules/semi.js index 2fd6980..0fe9a42 100644 --- a/src/rules/semi.js +++ b/src/rules/semi.js @@ -63,6 +63,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/sortKeys.js b/src/rules/sortKeys.js index 8f32576..9282537 100644 --- a/src/rules/sortKeys.js +++ b/src/rules/sortKeys.js @@ -215,6 +215,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/spaceAfterTypeColon.js b/src/rules/spaceAfterTypeColon.js index 90dfe41..f20d1bc 100644 --- a/src/rules/spaceAfterTypeColon.js +++ b/src/rules/spaceAfterTypeColon.js @@ -27,6 +27,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/spaceBeforeGenericBracket.js b/src/rules/spaceBeforeGenericBracket.js index 119ffd9..09fe7fe 100644 --- a/src/rules/spaceBeforeGenericBracket.js +++ b/src/rules/spaceBeforeGenericBracket.js @@ -59,6 +59,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/spaceBeforeTypeColon.js b/src/rules/spaceBeforeTypeColon.js index 48af8b9..b4d58bc 100644 --- a/src/rules/spaceBeforeTypeColon.js +++ b/src/rules/spaceBeforeTypeColon.js @@ -15,6 +15,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/spreadExactType.js b/src/rules/spreadExactType.js index 55fc5e6..e9bacbf 100644 --- a/src/rules/spreadExactType.js +++ b/src/rules/spreadExactType.js @@ -27,5 +27,7 @@ const create = (context) => ({ export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/typeIdMatch.js b/src/rules/typeIdMatch.js index c297588..06c1077 100644 --- a/src/rules/typeIdMatch.js +++ b/src/rules/typeIdMatch.js @@ -30,5 +30,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/typeImportStyle.js b/src/rules/typeImportStyle.js index bca445f..fd5a755 100644 --- a/src/rules/typeImportStyle.js +++ b/src/rules/typeImportStyle.js @@ -91,6 +91,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/unionIntersectionSpacing.js b/src/rules/unionIntersectionSpacing.js index d8554f9..06b67ec 100644 --- a/src/rules/unionIntersectionSpacing.js +++ b/src/rules/unionIntersectionSpacing.js @@ -79,6 +79,6 @@ export default { create, meta: { fixable: 'code', + schema, }, - schema, }; diff --git a/src/rules/useFlowType.js b/src/rules/useFlowType.js index b13cae0..35b98bc 100644 --- a/src/rules/useFlowType.js +++ b/src/rules/useFlowType.js @@ -54,5 +54,7 @@ const create = (context) => { export default { create, - schema, + meta: { + schema, + }, }; diff --git a/src/rules/useReadOnlySpread.js b/src/rules/useReadOnlySpread.js index d18e356..88e6e62 100644 --- a/src/rules/useReadOnlySpread.js +++ b/src/rules/useReadOnlySpread.js @@ -1,11 +1,3 @@ -const meta = { - messages: { - readonlySpread: - 'Flow type with spread property and all readonly properties must be ' - + 'wrapped in \'$ReadOnly<…>\' to prevent accidental loss of readonly-ness.', - }, -}; - const create = (context) => ({ TypeAlias(node) { if (node.right.type === 'GenericTypeAnnotation' && node.right.id.name === '$ReadOnly') { @@ -39,5 +31,11 @@ const create = (context) => ({ export default { create, - meta, + meta: { + messages: { + readonlySpread: + 'Flow type with spread property and all readonly properties must be ' + + 'wrapped in \'$ReadOnly<…>\' to prevent accidental loss of readonly-ness.', + }, + }, }; diff --git a/src/rules/validSyntax.js b/src/rules/validSyntax.js index 4533175..025b4e4 100644 --- a/src/rules/validSyntax.js +++ b/src/rules/validSyntax.js @@ -31,6 +31,6 @@ export default { create, meta: { deprecated: true, + schema, }, - schema, }; diff --git a/tests/rules/index.js b/tests/rules/index.js index 85da8b2..1f5048e 100644 --- a/tests/rules/index.js +++ b/tests/rules/index.js @@ -75,7 +75,7 @@ for (const ruleName of reportingRules) { RuleTester.describe(ruleName, () => { RuleTester.describe('misconfigured', () => { RuleTester.it(JSON.stringify(misconfiguration.options), () => { - const schema = plugin.rules[ruleName].schema && plugin.rules[ruleName].schema; + const schema = plugin.rules[ruleName].meta && plugin.rules[ruleName].meta.schema && plugin.rules[ruleName].meta.schema; if (!schema) { throw new Error('No schema.');