@@ -49,18 +49,6 @@ function hasMetaDocs(metaPropertyNode) {
4949 return Boolean ( getPropertyFromObject ( 'docs' , metaPropertyNode . value ) )
5050}
5151
52- /**
53- * Whether this `meta` ObjectExpression has a `docs.description` property defined or not.
54- *
55- * @param {ASTNode } metaPropertyNode The `meta` ObjectExpression for this rule.
56- * @returns {boolean } `true` if a `docs.description` property exists.
57- */
58- function hasMetaDocsDescription ( metaPropertyNode ) {
59- const metaDocs = getPropertyFromObject ( 'docs' , metaPropertyNode . value )
60-
61- return metaDocs && getPropertyFromObject ( 'description' , metaDocs . value )
62- }
63-
6452/**
6553 * Whether this `meta` ObjectExpression has a `docs.category` property defined or not.
6654 *
@@ -73,16 +61,6 @@ function hasMetaDocsCategories(metaPropertyNode) {
7361 return metaDocs && getPropertyFromObject ( 'categories' , metaDocs . value )
7462}
7563
76- /**
77- * Whether this `meta` ObjectExpression has a `schema` property defined or not.
78- *
79- * @param {ASTNode } metaPropertyNode The `meta` ObjectExpression for this rule.
80- * @returns {boolean } `true` if a `schema` property exists.
81- */
82- function hasMetaSchema ( metaPropertyNode ) {
83- return getPropertyFromObject ( 'schema' , metaPropertyNode . value )
84- }
85-
8664/**
8765 * Checks the validity of the meta definition of this rule and reports any errors found.
8866 *
@@ -104,35 +82,13 @@ function checkMetaValidity(context, exportsNode) {
10482 return
10583 }
10684
107- if ( ! hasMetaDocsDescription ( metaProperty ) ) {
108- context . report (
109- metaProperty ,
110- 'Rule is missing a meta.docs.description property.'
111- )
112- return
113- }
114-
11585 if ( ! hasMetaDocsCategories ( metaProperty ) ) {
11686 context . report (
11787 metaProperty ,
11888 'Rule is missing a meta.docs.categories property.'
11989 )
12090 return
12191 }
122-
123- if ( ! hasMetaSchema ( metaProperty ) ) {
124- context . report ( metaProperty , 'Rule is missing a meta.schema property.' )
125- }
126- }
127-
128- /**
129- * Whether this node is the correct format for a rule definition or not.
130- *
131- * @param {ASTNode } node node that the rule exports.
132- * @returns {boolean } `true` if the exported node is the correct format for a rule definition
133- */
134- function isCorrectExportsFormat ( node ) {
135- return node != null && node . type === 'ObjectExpression'
13692}
13793
13894// ------------------------------------------------------------------------------
@@ -166,15 +122,6 @@ module.exports = {
166122 } ,
167123
168124 'Program:exit' ( programNode ) {
169- if ( ! isCorrectExportsFormat ( exportsNode ) ) {
170- context . report ( {
171- node : exportsNode || programNode ,
172- message :
173- 'Rule does not export an Object. Make sure the rule follows the new rule format.'
174- } )
175- return
176- }
177-
178125 checkMetaValidity ( context , exportsNode )
179126 }
180127 }
0 commit comments