diff --git a/.README/rules/filename-match-exported.md b/.README/rules/filename-match-exported.md index f4a1779..aaec6ac 100644 --- a/.README/rules/filename-match-exported.md +++ b/.README/rules/filename-match-exported.md @@ -19,7 +19,7 @@ export default { foo: "bar" }; If your filename policy doesn't quite match with your variable naming policy, you can add one or multiple transforms: ```json -"canonical/filename-match-exported": [ 2, "kebab" ] +"canonical/filename-match-exported": [ 2, { "transforms": "kebab" } ] ``` Now, in your code: @@ -31,21 +31,21 @@ export default function variableName; Available transforms: -* snake -* kebab -* camel -* pascal +* `snake` +* `kebab` +* `camel` +* `pascal` For multiple transforms simply specify an array like this (null in this case stands for no transform): ```json -"canonical/filename-match-exported": [2, [ null, "kebab", "snake" ] ] +"canonical/filename-match-exported": [2, { "transforms": [ null, "kebab", "snake" ] } ] ``` If you prefer to use suffixes for your files (e.g. `Foo.react.js` for a React component file), you can use a second configuration parameter. It allows you to remove parts of a filename matching a regex pattern before transforming and matching against the export. ```json -"canonical/filename-match-exported": [ 2, null, "\\.react$" ] +"canonical/filename-match-exported": [ 2, { "suffix": "\\.react$" } ] ``` Now, in your code: @@ -58,7 +58,7 @@ export default function variableName; If you also want to match exported function calls you can use the third option (a boolean flag). ```json -"canonical/filename-match-exported": [ 2, null, null, true ] +"canonical/filename-match-exported": [ 2, { "matchCallExpression": true } ] ``` Now, in your code: diff --git a/.README/rules/filename-match-regex.md b/.README/rules/filename-match-regex.md index 0c350b9..ba912cf 100644 --- a/.README/rules/filename-match-regex.md +++ b/.README/rules/filename-match-regex.md @@ -6,7 +6,7 @@ The convention can be configured using a regular expression (the default is `cam exporting files can be ignored with a second configuration parameter. ```json -"canonical/filename-match-regex": [2, "^[a-z_]+$", true] +"canonical/filename-match-regex": [2, { "regex": "^[a-z_]+$", "ignoreExporting": true }] ``` With these configuration options, `camelCase.js` will be reported as an error while `snake_case.js` will pass. diff --git a/README.md b/README.md index 65ccdec..be6b95f 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ export default { foo: "bar" }; If your filename policy doesn't quite match with your variable naming policy, you can add one or multiple transforms: ```json -"canonical/filename-match-exported": [ 2, "kebab" ] +"canonical/filename-match-exported": [ 2, { "transforms": "kebab" } ] ``` Now, in your code: @@ -168,21 +168,21 @@ export default function variableName; Available transforms: -* snake -* kebab -* camel -* pascal +* `snake` +* `kebab` +* `camel` +* `pascal` For multiple transforms simply specify an array like this (null in this case stands for no transform): ```json -"canonical/filename-match-exported": [2, [ null, "kebab", "snake" ] ] +"canonical/filename-match-exported": [2, { "transforms": [ null, "kebab", "snake" ] } ] ``` If you prefer to use suffixes for your files (e.g. `Foo.react.js` for a React component file), you can use a second configuration parameter. It allows you to remove parts of a filename matching a regex pattern before transforming and matching against the export. ```json -"canonical/filename-match-exported": [ 2, null, "\\.react$" ] +"canonical/filename-match-exported": [ 2, { "suffix": "\\.react$" } ] ``` Now, in your code: @@ -195,7 +195,7 @@ export default function variableName; If you also want to match exported function calls you can use the third option (a boolean flag). ```json -"canonical/filename-match-exported": [ 2, null, null, true ] +"canonical/filename-match-exported": [ 2, { "matchCallExpression": true } ] ``` Now, in your code: diff --git a/src/rules/destructuringPropertyNewline.ts b/src/rules/destructuringPropertyNewline.ts index 9994114..9969bed 100644 --- a/src/rules/destructuringPropertyNewline.ts +++ b/src/rules/destructuringPropertyNewline.ts @@ -1,9 +1,15 @@ import { createRule } from '../utilities'; -export default createRule({ - create(context) { - const allowAllPropertiesOnSameLine = - context.options[0]?.allowAllPropertiesOnSameLine; +type Options = [ + { + allowAllPropertiesOnSameLine: boolean; + }, +]; + +type MessageIds = 'propertiesOnNewline' | 'propertiesOnNewlineAll'; + +export default createRule({ + create(context, [{ allowAllPropertiesOnSameLine }]) { const messageId = allowAllPropertiesOnSameLine ? 'propertiesOnNewlineAll' : 'propertiesOnNewline'; diff --git a/src/rules/exportSpecifierNewline.ts b/src/rules/exportSpecifierNewline.ts index a68c401..53e6423 100644 --- a/src/rules/exportSpecifierNewline.ts +++ b/src/rules/exportSpecifierNewline.ts @@ -1,6 +1,10 @@ import { createRule } from '../utilities'; -export default createRule({ +type Options = []; + +type MessageIds = 'specifiersOnNewline'; + +export default createRule({ create: (context) => { return { ExportNamedDeclaration: (node) => { diff --git a/src/rules/filenameMatchExported.ts b/src/rules/filenameMatchExported.ts index 86220d9..a9787b9 100644 --- a/src/rules/filenameMatchExported.ts +++ b/src/rules/filenameMatchExported.ts @@ -64,108 +64,114 @@ const getWhatToMatchMessage = (transforms) => { return 'the exported and transformed name'; }; -const create = (context) => { - return { - Program(node) { - const transforms = getTransformsFromOptions(context.options[0]); - const replacePattern = context.options[1] - ? new RegExp(context.options[1], 'u') - : undefined; - const filename = context.getFilename(); - const absoluteFilename = path.resolve(filename); - const parsed = parseFilename(absoluteFilename); - const shouldIgnore = isIgnoredFilename(filename); - const exportedName = getExportedName(node, context.options); - const isExporting = Boolean(exportedName); - const expectedExport = getStringToCheckAgainstExport( - parsed, - replacePattern, - ); - const transformedNames = transform(exportedName, transforms); - const everythingIsIndex = - exportedName === 'index' && parsed.name === 'index'; - const matchesExported = - anyMatch(expectedExport, transformedNames) || everythingIsIndex; - const reportIf = function ( - condition, - messageForNormalFile, - messageForIndexFile, - ) { - const message = - !messageForIndexFile || !isIndexFile(parsed) - ? messageForNormalFile - : messageForIndexFile; - - if (condition) { - context.report({ - data: { - expectedExport, - exportName: transformedNames.join("', '"), - extension: parsed.ext, - name: parsed.base, - whatToMatch: getWhatToMatchMessage(transforms), - }, - message, - node, - }); +type Options = [ + { + matchCallExpression: boolean; + suffix: string | null; + transforms: string[] | string | null; + }, +]; + +type MessageIds = 'indexFile' | 'regularFile'; + +export default createRule({ + create: (context, options) => { + return { + Program(node) { + const transforms = getTransformsFromOptions(options[0].transforms); + const replacePattern = options[0].suffix + ? new RegExp(options[0].suffix, 'u') + : undefined; + const filename = context.getFilename(); + const absoluteFilename = path.resolve(filename); + const parsed = parseFilename(absoluteFilename); + const shouldIgnore = isIgnoredFilename(filename); + const exportedName = getExportedName( + node, + options[0].matchCallExpression, + ); + const isExporting = Boolean(exportedName); + const expectedExport = getStringToCheckAgainstExport( + parsed, + replacePattern, + ); + const transformedNames = transform(exportedName, transforms); + const everythingIsIndex = + exportedName === 'index' && parsed.name === 'index'; + const matchesExported = + anyMatch(expectedExport, transformedNames) || everythingIsIndex; + + if (shouldIgnore || !isExporting || matchesExported) { + return; } - }; - - if (shouldIgnore) { - return; - } - reportIf( - isExporting && !matchesExported, - "Filename '{{expectedExport}}' must match {{whatToMatch}} '{{exportName}}'.", - "The directory '{{expectedExport}}' must be named '{{exportName}}', after the exported value of its index file.", - ); + context.report({ + data: { + expectedExport, + exportName: transformedNames.join("', '"), + extension: parsed.ext, + name: parsed.base, + whatToMatch: getWhatToMatchMessage(transforms), + }, + messageId: isIndexFile(parsed) ? 'indexFile' : 'regularFile', + node, + }); + }, + }; + }, + defaultOptions: [ + { + matchCallExpression: false, + suffix: null, + transforms: null, }, - }; -}; - -export default createRule({ - create, - defaultOptions: [], + ], meta: { docs: { description: 'Match the file name against the default exported value in the module.', recommended: 'warn', }, - messages: {}, + messages: { + indexFile: + "The directory '{{expectedExport}}' must be named '{{exportName}}', after the exported value of its index file.", + regularFile: + "Filename '{{expectedExport}}' must match {{whatToMatch}} '{{exportName}}'.", + }, schema: [ { - anyOf: [ - { - items: { - type: 'string', - }, - type: 'array', + properties: { + matchCallExpression: { + type: 'boolean', }, - { - type: 'string', + suffix: { + oneOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], }, - { - type: 'null', + transforms: { + oneOf: [ + { + items: { + type: 'string', + }, + type: 'array', + }, + { + type: 'string', + }, + { + type: 'null', + }, + ], }, - ], - default: null, - }, - { - default: null, - oneOf: [ - { - type: 'string', - }, - { - type: 'null', - }, - ], - }, - { - default: false, - type: 'boolean', + }, + type: 'object', }, ], type: 'suggestion', diff --git a/src/rules/filenameMatchRegex.ts b/src/rules/filenameMatchRegex.ts index 39e2169..45e7da9 100644 --- a/src/rules/filenameMatchRegex.ts +++ b/src/rules/filenameMatchRegex.ts @@ -15,12 +15,21 @@ import { // eslint-disable-next-line unicorn/no-unsafe-regex const defaultRegexp = /^[\da-z]+(?:[A-Z][\da-z]+)*$/gu; -export default createRule({ - create: (context) => { - const conventionRegexp = context.options[0] - ? new RegExp(context.options[0], 'u') +type Options = [ + { + ignoreExporting: boolean; + regex: string | null; + }, +]; + +type MessageIds = 'notMatch'; + +export default createRule({ + create: (context, [options]) => { + const conventionRegexp = options.regex + ? new RegExp(options.regex, 'u') : defaultRegexp; - const ignoreExporting = context.options[1] ? context.options[1] : false; + const ignoreExporting = options.ignoreExporting; return { Program(node) { @@ -36,7 +45,7 @@ export default createRule({ return; } - const isExporting = Boolean(getExportedName(node)); + const isExporting = Boolean(getExportedName(node, false)); if (ignoreExporting && isExporting) { return; @@ -54,7 +63,12 @@ export default createRule({ }, }; }, - defaultOptions: [], + defaultOptions: [ + { + ignoreExporting: false, + regex: null, + }, + ], meta: { docs: { description: @@ -66,19 +80,22 @@ export default createRule({ }, schema: [ { - default: null, - oneOf: [ - { - type: 'string', + properties: { + ignoreExporting: { + type: 'boolean', }, - { - type: 'null', + regex: { + oneOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], }, - ], - }, - { - default: false, - type: 'boolean', + }, + type: 'object', }, ], type: 'suggestion', diff --git a/src/rules/filenameNoIndex.ts b/src/rules/filenameNoIndex.ts index 9b65f90..a7d4abf 100644 --- a/src/rules/filenameNoIndex.ts +++ b/src/rules/filenameNoIndex.ts @@ -32,7 +32,11 @@ const create = (context) => { }; }; -export default createRule({ +type Options = []; + +type MessageIds = 'noIndex'; + +export default createRule({ create, defaultOptions: [], meta: { diff --git a/src/rules/idMatch.ts b/src/rules/idMatch.ts index 1261ac3..d44a68b 100644 --- a/src/rules/idMatch.ts +++ b/src/rules/idMatch.ts @@ -41,22 +41,25 @@ const defaultOptions = { properties: false, }; -export default createRule({ - create: (context) => { - const [inputPattern, options] = context.options; +type Options = [ + string, + { + classFields: boolean; + ignoreDestructuring: boolean; + ignoreNamedImports: boolean; + onlyDeclarations: boolean; + properties: boolean; + }, +]; - const pattern = inputPattern ?? '^.+$'; +type MessageIds = 'notMatch' | 'notMatchPrivate'; - if (typeof pattern !== 'string') { - throw new TypeError('Unexpected configuration (a)'); - } +export default createRule({ + create: (context, [inputPattern, options]) => { + const pattern = inputPattern ?? '^.+$'; const regexp = new RegExp(pattern, 'u'); - if (typeof options !== 'object' && options !== undefined) { - throw new TypeError('Unexpected configuration (b)'); - } - const checkProperties = Boolean(options?.properties); const checkClassFields = Boolean(options?.classFields); const onlyDeclarations = Boolean(options?.onlyDeclarations); diff --git a/src/rules/importSpecifierNewline.ts b/src/rules/importSpecifierNewline.ts index 0c35239..24c1c5c 100644 --- a/src/rules/importSpecifierNewline.ts +++ b/src/rules/importSpecifierNewline.ts @@ -1,6 +1,10 @@ import { createRule } from '../utilities'; -export default createRule({ +type Options = []; + +type MessageIds = 'specifiersOnNewline'; + +export default createRule({ create: (context) => { return { ImportDeclaration: (node) => { diff --git a/src/rules/noRestrictedStrings.ts b/src/rules/noRestrictedStrings.ts index 034122f..b40a80d 100644 --- a/src/rules/noRestrictedStrings.ts +++ b/src/rules/noRestrictedStrings.ts @@ -1,11 +1,11 @@ import { createRule } from '../utilities'; -export default createRule({ - create: (context) => { - const { options } = context; +type Options = [string[]]; - const disallowedStrings = options[0] ?? []; +type MessageIds = 'disallowedString' | 'disallowedStringInTemplate'; +export default createRule({ + create: (context, [disallowedStrings]) => { return { Literal: (node) => { if ( @@ -44,7 +44,7 @@ export default createRule({ }, }; }, - defaultOptions: [[] as string[]], + defaultOptions: [[]], meta: { docs: { description: 'Disallowed string.', diff --git a/src/rules/noUnusedExports.ts b/src/rules/noUnusedExports.ts index d48f6b8..9243b96 100644 --- a/src/rules/noUnusedExports.ts +++ b/src/rules/noUnusedExports.ts @@ -18,9 +18,7 @@ type Options = [ type MessageIds = 'unusedExport'; export default createRule({ - create: (context) => { - const [options] = context.options; - + create: (context, [options]) => { const tsUnusedOptions: string[] = []; if (options.allowUnusedEnums) { diff --git a/src/rules/noUseExtendNative.ts b/src/rules/noUseExtendNative.ts index 1367c9b..0f3712c 100644 --- a/src/rules/noUseExtendNative.ts +++ b/src/rules/noUseExtendNative.ts @@ -145,7 +145,11 @@ const isInvalid = (jsType, propertyName, usageType) => { ); }; -export default createRule({ +type Options = []; + +type MessageIds = 'noExtendNative'; + +export default createRule({ create(context) { return { MemberExpression(node) { diff --git a/src/rules/preferImportAlias.ts b/src/rules/preferImportAlias.ts index 869b2d2..7cbdfff 100644 --- a/src/rules/preferImportAlias.ts +++ b/src/rules/preferImportAlias.ts @@ -28,9 +28,7 @@ type Options = [ type MessageIds = 'mustBeAlias' | 'mustBeAliasOrShallow'; export default createRule({ - create: (context) => { - const options = context.options[0] ?? {}; - + create: (context, [options]) => { const { aliases: temporaryAliases = [], baseDirectory = CWD } = options; const aliases = temporaryAliases.map((temporaryAlias) => { diff --git a/src/rules/preferInlineTypeImport.ts b/src/rules/preferInlineTypeImport.ts index 64ffbd7..8ccb6f4 100644 --- a/src/rules/preferInlineTypeImport.ts +++ b/src/rules/preferInlineTypeImport.ts @@ -15,7 +15,11 @@ const removeTypeSpecifier = function* (fixer, sourceCode, node) { } }; -export default createRule({ +type Options = []; + +type MessageIds = 'noTypeImport'; + +export default createRule({ create: (context) => { const sourceCode = context.getSourceCode(); return { diff --git a/src/rules/preferUseMount.ts b/src/rules/preferUseMount.ts index 800d06a..10ec273 100644 --- a/src/rules/preferUseMount.ts +++ b/src/rules/preferUseMount.ts @@ -1,6 +1,10 @@ import { createRule } from '../utilities'; -export default createRule({ +type Options = []; + +type MessageIds = 'noEffectWithoutDependencies'; + +export default createRule({ create: (context) => { return { CallExpression(node) { diff --git a/src/rules/sortKeys.ts b/src/rules/sortKeys.ts index 047d69c..2868dcd 100644 --- a/src/rules/sortKeys.ts +++ b/src/rules/sortKeys.ts @@ -149,11 +149,20 @@ const defaultOptions = { natural: false, }; -export default createRule({ - create(context) { - // Parse options. - const order = context.options[0] || 'asc'; - const options = context.options[1] ?? defaultOptions; +type Options = [ + 'asc' | 'desc', + { + caseSensitive: boolean; + natural: boolean; + }, +]; + +type MessageIds = 'sort'; + +export default createRule({ + create(context, userOptions) { + const order = userOptions[0]; + const options = userOptions[1]; if (typeof options === 'string') { throw new TypeError('Unexpected state'); diff --git a/src/utilities/getExportedName.ts b/src/utilities/getExportedName.ts index 1a6da5d..c933626 100644 --- a/src/utilities/getExportedName.ts +++ b/src/utilities/getExportedName.ts @@ -1,6 +1,6 @@ import { type TSESTree } from '@typescript-eslint/utils'; -const getNodeName = (node, options = []) => { +const getNodeName = (node, matchCallExpression) => { if (node.type === 'Identifier') { return node.name; } @@ -10,7 +10,7 @@ const getNodeName = (node, options = []) => { } if ( - options[2] && + matchCallExpression && node.type === 'CallExpression' && node.callee.type === 'Identifier' ) { @@ -22,12 +22,12 @@ const getNodeName = (node, options = []) => { export const getExportedName = ( programNode: TSESTree.Program, - options?: [], + matchCallExpression: boolean, ) => { for (const node of programNode.body) { // export default ... if (node.type === 'ExportDefaultDeclaration') { - return getNodeName(node.declaration, options); + return getNodeName(node.declaration, matchCallExpression); } // module.exports = ... @@ -40,7 +40,7 @@ export const getExportedName = ( node.expression.left.property.type === 'Identifier' && node.expression.left.property.name === 'exports' ) { - return getNodeName(node.expression.right, options); + return getNodeName(node.expression.right, matchCallExpression); } } diff --git a/tests/rules/assertions/filenameMatchExported.ts b/tests/rules/assertions/filenameMatchExported.ts index 8b4bf9e..7c43305 100644 --- a/tests/rules/assertions/filenameMatchExported.ts +++ b/tests/rules/assertions/filenameMatchExported.ts @@ -223,7 +223,7 @@ export default { }, ], filename: 'variableName.js', - options: ['snake'], + options: [{ transforms: 'snake' }], }, { code: camelCaseEs6, @@ -236,7 +236,7 @@ export default { }, ], filename: 'variableName.js', - options: ['kebab'], + options: [{ transforms: 'kebab' }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -253,7 +253,7 @@ export default { }, ], filename: 'variableName.js', - options: ['pascal'], + options: [{ transforms: 'pascal' }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -270,7 +270,7 @@ export default { }, ], filename: 'variableName.js', - options: [['pascal', 'snake']], + options: [{ transforms: ['pascal', 'snake'] }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -286,7 +286,7 @@ export default { }, ], filename: '/some/dir/Foo.bar.js', - options: [null, '\\.react$'], + options: [{ suffix: '\\.react$' }], parserOptions: { ecmaFeatures: { jsx: true, @@ -306,7 +306,7 @@ export default { }, ], filename: '/some/dir/Foo.react/index.js', - options: [null, '\\.react$'], + options: [{ suffix: '\\.react$' }], parserOptions: { ecmaFeatures: { jsx: true, @@ -325,7 +325,7 @@ export default { }, ], filename: '/some/dir/bar.js', - options: [null, null, true], + options: [{ matchCallExpression: true }], }, ], @@ -451,7 +451,6 @@ export default { sourceType: 'module', }, }, - { code: exportedEs6Index, @@ -465,27 +464,27 @@ export default { { code: camelCaseCommonJS, filename: 'variable_name.js', - options: ['snake'], + options: [{ transforms: 'snake' }], }, { code: camelCaseCommonJS, filename: 'variable_name/index.js', - options: ['snake'], + options: [{ transforms: 'snake' }], }, { code: camelCaseCommonJS, filename: 'variable-name.js', - options: ['kebab'], + options: [{ transforms: 'kebab' }], }, { code: snakeCaseCommonJS, filename: 'variableName.js', - options: ['camel'], + options: [{ transforms: 'camel' }], }, { code: camelCaseEs6, filename: 'variable_name.js', - options: ['snake'], + options: [{ transforms: 'snake' }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -494,7 +493,7 @@ export default { { code: camelCaseEs6, filename: 'variable-name.js', - options: ['kebab'], + options: [{ transforms: 'kebab' }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -503,7 +502,7 @@ export default { { code: snakeCaseEs6, filename: 'variableName.js', - options: ['camel'], + options: [{ transforms: 'camel' }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -512,7 +511,7 @@ export default { { code: snakeCaseEs6, filename: 'VariableName.js', - options: ['pascal'], + options: [{ transforms: 'pascal' }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -521,7 +520,7 @@ export default { { code: snakeCaseEs6, filename: 'variableName.js', - options: [['pascal', 'camel']], + options: [{ transforms: ['pascal', 'camel'] }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -530,7 +529,7 @@ export default { { code: snakeCaseEs6, filename: 'VariableName.js', - options: [['pascal', 'camel']], + options: [{ transforms: ['pascal', 'camel'] }], parserOptions: { ecmaVersion: 6, sourceType: 'module', @@ -539,7 +538,7 @@ export default { { code: exportedJsxClassCode, filename: '/some/dir/Foo.react.js', - options: [null, '\\.react$'], + options: [{ suffix: '\\.react$' }], parserOptions: { ecmaFeatures: { jsx: true, @@ -550,7 +549,7 @@ export default { { code: exportedEs6JsxClassCode, filename: '/some/dir/Foo.react.js', - options: [null, '\\.react$'], + options: [{ suffix: '\\.react$' }], parserOptions: { ecmaFeatures: { jsx: true, @@ -562,7 +561,7 @@ export default { { code: exportedCalledFunctionCode, filename: '/some/dir/foo.js', - options: [null, null, true], + options: [{ matchCallExpression: true }], }, ], }; diff --git a/tests/rules/assertions/filenameMatchRegex.ts b/tests/rules/assertions/filenameMatchRegex.ts index f210098..787dc8a 100644 --- a/tests/rules/assertions/filenameMatchRegex.ts +++ b/tests/rules/assertions/filenameMatchRegex.ts @@ -49,7 +49,7 @@ export default { }, ], filename: 'fooBar.js', - options: ['^[a-z_]$'], + options: [{ regex: '^[a-z_]$' }], }, ], @@ -69,12 +69,12 @@ export default { { code: testCode, filename: 'foo_bar.js', - options: ['^[a-z_]+$'], + options: [{ regex: '^[a-z_]+$' }], }, { code: testCode, filename: '/foo/dir/foo_bar.js', - options: ['^[a-z_]+$'], + options: [{ regex: '^[a-z_]+$' }], }, { code: testCode, @@ -83,17 +83,17 @@ export default { { code: exportingCode, filename: 'foo_bar.js', - options: [null, true], + options: [{ ignoreExporting: true }], }, { code: exportingCode, filename: 'fooBar.js', - options: ['^[a-z_]$', true], + options: [{ ignoreExporting: true, regex: '^[a-z_]$' }], }, { code: exportedFunctionCall, filename: 'foo_bar.js', - options: ['^[a-z_]+$', true], + options: [{ ignoreExporting: true, regex: '^[a-z_]+$' }], }, ], };