@@ -178,113 +178,116 @@ export {
178178 parseComment
179179} ;
180180
181- export default ( iterator ) => {
182- return ( context ) => {
183- const sourceCode = context . getSourceCode ( ) ;
184- const tagNamePreference = _ . get ( context , 'settings.jsdoc.tagNamePreference' ) || { } ;
185- const exampleCodeRegex = _ . get ( context , 'settings.jsdoc.exampleCodeRegex' ) || null ;
186- const rejectExampleCodeRegex = _ . get ( context , 'settings.jsdoc.rejectExampleCodeRegex' ) || null ;
187- const matchingFileName = _ . get ( context , 'settings.jsdoc.matchingFileName' ) || null ;
188- const additionalTagNames = _ . get ( context , 'settings.jsdoc.additionalTagNames' ) || { } ;
189- const baseConfig = _ . get ( context , 'settings.jsdoc.baseConfig' ) || { } ;
190- const configFile = _ . get ( context , 'settings.jsdoc.configFile' ) ;
191- const eslintrcForExamples = _ . get ( context , 'settings.jsdoc.eslintrcForExamples' ) !== false ;
192- const allowInlineConfig = _ . get ( context , 'settings.jsdoc.allowInlineConfig' ) !== false ;
193- const allowEmptyNamepaths = _ . get ( context , 'settings.jsdoc.allowEmptyNamepaths' ) !== false ;
194- const reportUnusedDisableDirectives = _ . get ( context , 'settings.jsdoc.reportUnusedDisableDirectives' ) !== false ;
195- const captionRequired = Boolean ( _ . get ( context , 'settings.jsdoc.captionRequired' ) ) ;
196- const noDefaultExampleRules = Boolean ( _ . get ( context , 'settings.jsdoc.noDefaultExampleRules' ) ) ;
197- const allowOverrideWithoutParam = Boolean ( _ . get ( context , 'settings.jsdoc.allowOverrideWithoutParam' ) ) ;
198- const allowImplementsWithoutParam = Boolean ( _ . get ( context , 'settings.jsdoc.allowImplementsWithoutParam' ) ) ;
199- const allowAugmentsExtendsWithoutParam = Boolean ( _ . get ( context , 'settings.jsdoc.allowAugmentsExtendsWithoutParam' ) ) ;
200- const checkSeesForNamepaths = Boolean ( _ . get ( context , 'settings.jsdoc.checkSeesForNamepaths' ) ) ;
201-
202- const checkJsdoc = ( functionNode ) => {
203- const jsdocNode = sourceCode . getJSDocComment ( functionNode ) ;
204-
205- if ( ! jsdocNode ) {
206- return ;
207- }
181+ export default ( iterator , meta ) => {
182+ return {
183+ create ( context ) {
184+ const sourceCode = context . getSourceCode ( ) ;
185+ const tagNamePreference = _ . get ( context , 'settings.jsdoc.tagNamePreference' ) || { } ;
186+ const exampleCodeRegex = _ . get ( context , 'settings.jsdoc.exampleCodeRegex' ) || null ;
187+ const rejectExampleCodeRegex = _ . get ( context , 'settings.jsdoc.rejectExampleCodeRegex' ) || null ;
188+ const matchingFileName = _ . get ( context , 'settings.jsdoc.matchingFileName' ) || null ;
189+ const additionalTagNames = _ . get ( context , 'settings.jsdoc.additionalTagNames' ) || { } ;
190+ const baseConfig = _ . get ( context , 'settings.jsdoc.baseConfig' ) || { } ;
191+ const configFile = _ . get ( context , 'settings.jsdoc.configFile' ) ;
192+ const eslintrcForExamples = _ . get ( context , 'settings.jsdoc.eslintrcForExamples' ) !== false ;
193+ const allowInlineConfig = _ . get ( context , 'settings.jsdoc.allowInlineConfig' ) !== false ;
194+ const allowEmptyNamepaths = _ . get ( context , 'settings.jsdoc.allowEmptyNamepaths' ) !== false ;
195+ const reportUnusedDisableDirectives = _ . get ( context , 'settings.jsdoc.reportUnusedDisableDirectives' ) !== false ;
196+ const captionRequired = Boolean ( _ . get ( context , 'settings.jsdoc.captionRequired' ) ) ;
197+ const noDefaultExampleRules = Boolean ( _ . get ( context , 'settings.jsdoc.noDefaultExampleRules' ) ) ;
198+ const allowOverrideWithoutParam = Boolean ( _ . get ( context , 'settings.jsdoc.allowOverrideWithoutParam' ) ) ;
199+ const allowImplementsWithoutParam = Boolean ( _ . get ( context , 'settings.jsdoc.allowImplementsWithoutParam' ) ) ;
200+ const allowAugmentsExtendsWithoutParam = Boolean ( _ . get ( context , 'settings.jsdoc.allowAugmentsExtendsWithoutParam' ) ) ;
201+ const checkSeesForNamepaths = Boolean ( _ . get ( context , 'settings.jsdoc.checkSeesForNamepaths' ) ) ;
202+
203+ const checkJsdoc = ( functionNode ) => {
204+ const jsdocNode = sourceCode . getJSDocComment ( functionNode ) ;
205+
206+ if ( ! jsdocNode ) {
207+ return ;
208+ }
208209
209- const ancestors = context . getAncestors ( ) ;
210+ const ancestors = context . getAncestors ( ) ;
210211
211- const indent = _ . repeat ( ' ' , jsdocNode . loc . start . column ) ;
212+ const indent = _ . repeat ( ' ' , jsdocNode . loc . start . column ) ;
212213
213- const jsdoc = parseComment ( jsdocNode , indent ) ;
214+ const jsdoc = parseComment ( jsdocNode , indent ) ;
214215
215- const report = ( message , fixer = null , jsdocLoc = null ) => {
216- let loc ;
216+ const report = ( message , fixer = null , jsdocLoc = null ) => {
217+ let loc ;
217218
218- if ( jsdocLoc ) {
219- const lineNumber = jsdocNode . loc . start . line + jsdocLoc . line ;
219+ if ( jsdocLoc ) {
220+ const lineNumber = jsdocNode . loc . start . line + jsdocLoc . line ;
220221
221- loc = {
222- end : { line : lineNumber } ,
223- start : { line : lineNumber }
224- } ;
225- if ( jsdocLoc . column ) {
226- const colNumber = jsdocNode . loc . start . column + jsdocLoc . column ;
222+ loc = {
223+ end : { line : lineNumber } ,
224+ start : { line : lineNumber }
225+ } ;
226+ if ( jsdocLoc . column ) {
227+ const colNumber = jsdocNode . loc . start . column + jsdocLoc . column ;
227228
228- loc . end . column = colNumber ;
229- loc . start . column = colNumber ;
229+ loc . end . column = colNumber ;
230+ loc . start . column = colNumber ;
231+ }
230232 }
231- }
232- if ( fixer === null ) {
233- context . report ( {
234- loc,
235- message,
236- node : jsdocNode
237- } ) ;
238- } else {
239- context . report ( {
240- fix : fixer ,
241- loc,
242- message,
243- node : jsdocNode
244- } ) ;
245- }
233+ if ( fixer === null ) {
234+ context . report ( {
235+ loc,
236+ message,
237+ node : jsdocNode
238+ } ) ;
239+ } else {
240+ context . report ( {
241+ fix : fixer ,
242+ loc,
243+ message,
244+ node : jsdocNode
245+ } ) ;
246+ }
247+ } ;
248+
249+ const utils = curryUtils (
250+ functionNode ,
251+ jsdoc ,
252+ tagNamePreference ,
253+ exampleCodeRegex ,
254+ rejectExampleCodeRegex ,
255+ additionalTagNames ,
256+ baseConfig ,
257+ configFile ,
258+ captionRequired ,
259+ matchingFileName ,
260+ eslintrcForExamples ,
261+ allowInlineConfig ,
262+ allowEmptyNamepaths ,
263+ reportUnusedDisableDirectives ,
264+ noDefaultExampleRules ,
265+ allowOverrideWithoutParam ,
266+ allowImplementsWithoutParam ,
267+ allowAugmentsExtendsWithoutParam ,
268+ checkSeesForNamepaths ,
269+ ancestors ,
270+ sourceCode
271+ ) ;
272+
273+ iterator ( {
274+ context,
275+ functionNode,
276+ indent,
277+ jsdoc,
278+ jsdocNode,
279+ report,
280+ sourceCode,
281+ utils
282+ } ) ;
246283 } ;
247284
248- const utils = curryUtils (
249- functionNode ,
250- jsdoc ,
251- tagNamePreference ,
252- exampleCodeRegex ,
253- rejectExampleCodeRegex ,
254- additionalTagNames ,
255- baseConfig ,
256- configFile ,
257- captionRequired ,
258- matchingFileName ,
259- eslintrcForExamples ,
260- allowInlineConfig ,
261- allowEmptyNamepaths ,
262- reportUnusedDisableDirectives ,
263- noDefaultExampleRules ,
264- allowOverrideWithoutParam ,
265- allowImplementsWithoutParam ,
266- allowAugmentsExtendsWithoutParam ,
267- checkSeesForNamepaths ,
268- ancestors ,
269- sourceCode
270- ) ;
271-
272- iterator ( {
273- context,
274- functionNode,
275- indent,
276- jsdoc,
277- jsdocNode,
278- report,
279- sourceCode,
280- utils
281- } ) ;
282- } ;
283-
284- return {
285- ArrowFunctionExpression : checkJsdoc ,
286- FunctionDeclaration : checkJsdoc ,
287- FunctionExpression : checkJsdoc
288- } ;
285+ return {
286+ ArrowFunctionExpression : checkJsdoc ,
287+ FunctionDeclaration : checkJsdoc ,
288+ FunctionExpression : checkJsdoc
289+ } ;
290+ } ,
291+ meta
289292 } ;
290293} ;
0 commit comments