@ygyg/yg-cli
Version:
A simple CLI for front-end engineering automation construction tool.
1,629 lines (1,628 loc) • 249 kB
JavaScript
window.RulesMeta = {
'accessor-pairs': {
type: 'suggestion',
docs: {
description: 'enforce getter and setter pairs in objects',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/accessor-pairs',
},
schema: [
{
type: 'object',
properties: {
getWithoutSet: { type: 'boolean', default: false },
setWithoutGet: { type: 'boolean', default: true },
},
additionalProperties: false,
},
],
messages: {
getter: 'Getter is not present.',
setter: 'Setter is not present.',
},
},
'array-bracket-newline': {
type: 'layout',
docs: {
description:
'enforce linebreaks after opening and before closing array brackets',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/array-bracket-newline',
},
fixable: 'whitespace',
schema: [
{
oneOf: [
{ enum: ['always', 'never', 'consistent'] },
{
type: 'object',
properties: {
multiline: { type: 'boolean' },
minItems: { type: ['integer', 'null'], minimum: 0 },
},
additionalProperties: false,
},
],
},
],
messages: {
unexpectedOpeningLinebreak: "There should be no linebreak after '['.",
unexpectedClosingLinebreak: "There should be no linebreak before ']'.",
missingOpeningLinebreak: "A linebreak is required after '['.",
missingClosingLinebreak: "A linebreak is required before ']'.",
},
},
'array-bracket-spacing': {
type: 'layout',
docs: {
description: 'enforce consistent spacing inside array brackets',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/array-bracket-spacing',
},
fixable: 'whitespace',
schema: [
{ enum: ['always', 'never'] },
{
type: 'object',
properties: {
singleValue: { type: 'boolean' },
objectsInArrays: { type: 'boolean' },
arraysInArrays: { type: 'boolean' },
},
additionalProperties: false,
},
],
messages: {
unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.",
unexpectedSpaceBefore:
"There should be no space before '{{tokenValue}}'.",
missingSpaceAfter: "A space is required after '{{tokenValue}}'.",
missingSpaceBefore: "A space is required before '{{tokenValue}}'.",
},
},
'array-callback-return': {
type: 'problem',
docs: {
description: 'enforce `return` statements in callbacks of array methods',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/array-callback-return',
},
schema: [
{
type: 'object',
properties: { allowImplicit: { type: 'boolean', default: false } },
additionalProperties: false,
},
],
messages: {
expectedAtEnd: 'Expected to return a value at the end of {{name}}.',
expectedInside: 'Expected to return a value in {{name}}.',
expectedReturnValue: '{{name}} expected a return value.',
},
},
'array-element-newline': {
type: 'layout',
docs: {
description: 'enforce line breaks after each array element',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/array-element-newline',
},
fixable: 'whitespace',
schema: [
{
oneOf: [
{ enum: ['always', 'never', 'consistent'] },
{
type: 'object',
properties: {
multiline: { type: 'boolean' },
minItems: { type: ['integer', 'null'], minimum: 0 },
},
additionalProperties: false,
},
],
},
],
messages: {
unexpectedLineBreak: 'There should be no linebreak here.',
missingLineBreak: 'There should be a linebreak after this element.',
},
},
'arrow-body-style': {
type: 'suggestion',
docs: {
description: 'require braces around arrow function bodies',
category: 'ECMAScript 6',
recommended: false,
url: 'https://eslint.org/docs/rules/arrow-body-style',
},
schema: {
anyOf: [
{
type: 'array',
items: [{ enum: ['always', 'never'] }],
minItems: 0,
maxItems: 1,
},
{
type: 'array',
items: [
{ enum: ['as-needed'] },
{
type: 'object',
properties: {
requireReturnForObjectLiteral: { type: 'boolean' },
},
additionalProperties: false,
},
],
minItems: 0,
maxItems: 2,
},
],
},
fixable: 'code',
messages: {
unexpectedOtherBlock:
'Unexpected block statement surrounding arrow body.',
unexpectedEmptyBlock:
'Unexpected block statement surrounding arrow body; put a value of `undefined` immediately after the `=>`.',
unexpectedObjectBlock:
'Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>`.',
unexpectedSingleBlock:
'Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`.',
expectedBlock: 'Expected block statement surrounding arrow body.',
},
},
'arrow-parens': {
type: 'layout',
docs: {
description: 'require parentheses around arrow function arguments',
category: 'ECMAScript 6',
recommended: false,
url: 'https://eslint.org/docs/rules/arrow-parens',
},
fixable: 'code',
schema: [
{ enum: ['always', 'as-needed'] },
{
type: 'object',
properties: {
requireForBlockBody: { type: 'boolean', default: false },
},
additionalProperties: false,
},
],
messages: {
unexpectedParens:
'Unexpected parentheses around single function argument.',
expectedParens: 'Expected parentheses around arrow function argument.',
unexpectedParensInline:
'Unexpected parentheses around single function argument having a body with no curly braces.',
expectedParensBlock:
'Expected parentheses around arrow function argument having a body with curly braces.',
},
},
'arrow-spacing': {
type: 'layout',
docs: {
description:
'enforce consistent spacing before and after the arrow in arrow functions',
category: 'ECMAScript 6',
recommended: false,
url: 'https://eslint.org/docs/rules/arrow-spacing',
},
fixable: 'whitespace',
schema: [
{
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
],
messages: {
expectedBefore: 'Missing space before =>.',
unexpectedBefore: 'Unexpected space before =>.',
expectedAfter: 'Missing space after =>.',
unexpectedAfter: 'Unexpected space after =>.',
},
},
'block-scoped-var': {
type: 'suggestion',
docs: {
description:
'enforce the use of variables within the scope they are defined',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/block-scoped-var',
},
schema: [],
messages: { outOfScope: "'{{name}}' used outside of binding context." },
},
'block-spacing': {
type: 'layout',
docs: {
description:
'disallow or enforce spaces inside of blocks after opening block and before closing block',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/block-spacing',
},
fixable: 'whitespace',
schema: [{ enum: ['always', 'never'] }],
messages: {
missing: "Requires a space {{location}} '{{token}}'.",
extra: "Unexpected space(s) {{location}} '{{token}}'.",
},
},
'brace-style': {
type: 'layout',
docs: {
description: 'enforce consistent brace style for blocks',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/brace-style',
},
schema: [
{ enum: ['1tbs', 'stroustrup', 'allman'] },
{
type: 'object',
properties: { allowSingleLine: { type: 'boolean', default: false } },
additionalProperties: false,
},
],
fixable: 'whitespace',
messages: {
nextLineOpen:
'Opening curly brace does not appear on the same line as controlling statement.',
sameLineOpen:
'Opening curly brace appears on the same line as controlling statement.',
blockSameLine: 'Statement inside of curly braces should be on next line.',
nextLineClose:
'Closing curly brace does not appear on the same line as the subsequent block.',
singleLineClose:
'Closing curly brace should be on the same line as opening curly brace or on the line after the previous block.',
sameLineClose:
'Closing curly brace appears on the same line as the subsequent block.',
},
},
'callback-return': {
type: 'suggestion',
docs: {
description: 'require `return` statements after callbacks',
category: 'Node.js and CommonJS',
recommended: false,
url: 'https://eslint.org/docs/rules/callback-return',
},
schema: [{ type: 'array', items: { type: 'string' } }],
messages: { missingReturn: 'Expected return with your callback function.' },
},
camelcase: {
type: 'suggestion',
docs: {
description: 'enforce camelcase naming convention',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/camelcase',
},
schema: [
{
type: 'object',
properties: {
ignoreDestructuring: { type: 'boolean', default: false },
properties: { enum: ['always', 'never'] },
allow: {
type: 'array',
items: [{ type: 'string' }],
minItems: 0,
uniqueItems: true,
},
},
additionalProperties: false,
},
],
messages: { notCamelCase: "Identifier '{{name}}' is not in camel case." },
},
'capitalized-comments': {
type: 'suggestion',
docs: {
description:
'enforce or disallow capitalization of the first letter of a comment',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/capitalized-comments',
},
fixable: 'code',
schema: [
{ enum: ['always', 'never'] },
{
oneOf: [
{
type: 'object',
properties: {
ignorePattern: { type: 'string' },
ignoreInlineComments: { type: 'boolean' },
ignoreConsecutiveComments: { type: 'boolean' },
},
additionalProperties: false,
},
{
type: 'object',
properties: {
line: {
type: 'object',
properties: {
ignorePattern: { type: 'string' },
ignoreInlineComments: { type: 'boolean' },
ignoreConsecutiveComments: { type: 'boolean' },
},
additionalProperties: false,
},
block: {
type: 'object',
properties: {
ignorePattern: { type: 'string' },
ignoreInlineComments: { type: 'boolean' },
ignoreConsecutiveComments: { type: 'boolean' },
},
additionalProperties: false,
},
},
additionalProperties: false,
},
],
},
],
messages: {
unexpectedLowercaseComment:
'Comments should not begin with a lowercase character.',
unexpectedUppercaseComment:
'Comments should not begin with an uppercase character.',
},
},
'class-methods-use-this': {
type: 'suggestion',
docs: {
description: 'enforce that class methods utilize `this`',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/class-methods-use-this',
},
schema: [
{
type: 'object',
properties: {
exceptMethods: { type: 'array', items: { type: 'string' } },
},
additionalProperties: false,
},
],
messages: {
missingThis: "Expected 'this' to be used by class method '{{name}}'.",
},
},
'comma-dangle': {
type: 'layout',
docs: {
description: 'require or disallow trailing commas',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/comma-dangle',
},
fixable: 'code',
schema: {
definitions: {
value: {
enum: ['always-multiline', 'always', 'never', 'only-multiline'],
},
valueWithIgnore: {
enum: [
'always-multiline',
'always',
'ignore',
'never',
'only-multiline',
],
},
},
type: 'array',
items: [
{
oneOf: [
{ $ref: '#/definitions/value' },
{
type: 'object',
properties: {
arrays: { $ref: '#/definitions/valueWithIgnore' },
objects: { $ref: '#/definitions/valueWithIgnore' },
imports: { $ref: '#/definitions/valueWithIgnore' },
exports: { $ref: '#/definitions/valueWithIgnore' },
functions: { $ref: '#/definitions/valueWithIgnore' },
},
additionalProperties: false,
},
],
},
],
},
messages: {
unexpected: 'Unexpected trailing comma.',
missing: 'Missing trailing comma.',
},
},
'comma-spacing': {
type: 'layout',
docs: {
description: 'enforce consistent spacing before and after commas',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/comma-spacing',
},
fixable: 'whitespace',
schema: [
{
type: 'object',
properties: {
before: { type: 'boolean', default: false },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
],
messages: {
missing: "A space is required {{loc}} ','.",
unexpected: "There should be no space {{loc}} ','.",
},
},
'comma-style': {
type: 'layout',
docs: {
description: 'enforce consistent comma style',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/comma-style',
},
fixable: 'code',
schema: [
{ enum: ['first', 'last'] },
{
type: 'object',
properties: {
exceptions: {
type: 'object',
additionalProperties: { type: 'boolean' },
},
},
additionalProperties: false,
},
],
messages: {
unexpectedLineBeforeAndAfterComma:
"Bad line breaking before and after ','.",
expectedCommaFirst: "',' should be placed first.",
expectedCommaLast: "',' should be placed last.",
},
},
complexity: {
type: 'suggestion',
docs: {
description:
'enforce a maximum cyclomatic complexity allowed in a program',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/complexity',
},
schema: [
{
oneOf: [
{ type: 'integer', minimum: 0 },
{
type: 'object',
properties: {
maximum: { type: 'integer', minimum: 0 },
max: { type: 'integer', minimum: 0 },
},
additionalProperties: false,
},
],
},
],
messages: { complex: '{{name}} has a complexity of {{complexity}}.' },
},
'computed-property-spacing': {
type: 'layout',
docs: {
description:
'enforce consistent spacing inside computed property brackets',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/computed-property-spacing',
},
fixable: 'whitespace',
schema: [{ enum: ['always', 'never'] }],
messages: {
unexpectedSpaceBefore:
"There should be no space before '{{tokenValue}}'.",
unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.",
missingSpaceBefore: "A space is required before '{{tokenValue}}'.",
missingSpaceAfter: "A space is required after '{{tokenValue}}'.",
},
},
'consistent-return': {
type: 'suggestion',
docs: {
description:
'require `return` statements to either always or never specify values',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/consistent-return',
},
schema: [
{
type: 'object',
properties: {
treatUndefinedAsUnspecified: { type: 'boolean', default: false },
},
additionalProperties: false,
},
],
messages: {
missingReturn: 'Expected to return a value at the end of {{name}}.',
missingReturnValue: '{{name}} expected a return value.',
unexpectedReturnValue: '{{name}} expected no return value.',
},
},
'consistent-this': {
type: 'suggestion',
docs: {
description:
'enforce consistent naming when capturing the current execution context',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/consistent-this',
},
schema: {
type: 'array',
items: { type: 'string', minLength: 1 },
uniqueItems: true,
},
messages: {
aliasNotAssignedToThis:
"Designated alias '{{name}}' is not assigned to 'this'.",
unexpectedAlias: "Unexpected alias '{{name}}' for 'this'.",
},
},
'constructor-super': {
type: 'problem',
docs: {
description: 'require `super()` calls in constructors',
category: 'ECMAScript 6',
recommended: true,
url: 'https://eslint.org/docs/rules/constructor-super',
},
schema: [],
messages: {
missingSome: "Lacked a call of 'super()' in some code paths.",
missingAll: "Expected to call 'super()'.",
duplicate: "Unexpected duplicate 'super()'.",
badSuper: "Unexpected 'super()' because 'super' is not a constructor.",
unexpected: "Unexpected 'super()'.",
},
},
curly: {
type: 'suggestion',
docs: {
description: 'enforce consistent brace style for all control statements',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/curly',
},
schema: {
anyOf: [
{ type: 'array', items: [{ enum: ['all'] }], minItems: 0, maxItems: 1 },
{
type: 'array',
items: [
{ enum: ['multi', 'multi-line', 'multi-or-nest'] },
{ enum: ['consistent'] },
],
minItems: 0,
maxItems: 2,
},
],
},
fixable: 'code',
messages: {
missingCurlyAfter: "Expected { after '{{name}}'.",
missingCurlyAfterCondition: "Expected { after '{{name}}' condition.",
unexpectedCurlyAfter: "Unnecessary { after '{{name}}'.",
unexpectedCurlyAfterCondition:
"Unnecessary { after '{{name}}' condition.",
},
},
'default-case': {
type: 'suggestion',
docs: {
description: 'require `default` cases in `switch` statements',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/default-case',
},
schema: [
{
type: 'object',
properties: { commentPattern: { type: 'string' } },
additionalProperties: false,
},
],
messages: { missingDefaultCase: 'Expected a default case.' },
},
'dot-location': {
type: 'layout',
docs: {
description: 'enforce consistent newlines before and after dots',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/dot-location',
},
schema: [{ enum: ['object', 'property'] }],
fixable: 'code',
messages: {
expectedDotAfterObject: 'Expected dot to be on same line as object.',
expectedDotBeforeProperty: 'Expected dot to be on same line as property.',
},
},
'dot-notation': {
type: 'suggestion',
docs: {
description: 'enforce dot notation whenever possible',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/dot-notation',
},
schema: [
{
type: 'object',
properties: {
allowKeywords: { type: 'boolean', default: true },
allowPattern: { type: 'string', default: '' },
},
additionalProperties: false,
},
],
fixable: 'code',
messages: {
useDot: '[{{key}}] is better written in dot notation.',
useBrackets: '.{{key}} is a syntax error.',
},
},
'eol-last': {
type: 'layout',
docs: {
description: 'require or disallow newline at the end of files',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/eol-last',
},
fixable: 'whitespace',
schema: [{ enum: ['always', 'never', 'unix', 'windows'] }],
messages: {
missing: 'Newline required at end of file but not found.',
unexpected: 'Newline not allowed at end of file.',
},
},
eqeqeq: {
type: 'suggestion',
docs: {
description: 'require the use of `===` and `!==`',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/eqeqeq',
},
schema: {
anyOf: [
{
type: 'array',
items: [
{ enum: ['always'] },
{
type: 'object',
properties: { null: { enum: ['always', 'never', 'ignore'] } },
additionalProperties: false,
},
],
additionalItems: false,
},
{
type: 'array',
items: [{ enum: ['smart', 'allow-null'] }],
additionalItems: false,
},
],
},
fixable: 'code',
messages: {
unexpected:
"Expected '{{expectedOperator}}' and instead saw '{{actualOperator}}'.",
},
},
'for-direction': {
type: 'problem',
docs: {
description:
'enforce "for" loop update clause moving the counter in the right direction.',
category: 'Possible Errors',
recommended: true,
url: 'https://eslint.org/docs/rules/for-direction',
},
fixable: null,
schema: [],
messages: {
incorrectDirection:
'The update clause in this loop moves the variable in the wrong direction.',
},
},
'func-call-spacing': {
type: 'layout',
docs: {
description:
'require or disallow spacing between function identifiers and their invocations',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/func-call-spacing',
},
fixable: 'whitespace',
schema: {
anyOf: [
{
type: 'array',
items: [{ enum: ['never'] }],
minItems: 0,
maxItems: 1,
},
{
type: 'array',
items: [
{ enum: ['always'] },
{
type: 'object',
properties: { allowNewlines: { type: 'boolean' } },
additionalProperties: false,
},
],
minItems: 0,
maxItems: 2,
},
],
},
messages: {
unexpected: 'Unexpected newline between function name and paren.',
missing: 'Missing space between function name and paren.',
},
},
'func-name-matching': {
type: 'suggestion',
docs: {
description:
'require function names to match the name of the variable or property to which they are assigned',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/func-name-matching',
},
schema: {
anyOf: [
{
type: 'array',
additionalItems: false,
items: [
{ enum: ['always', 'never'] },
{
type: 'object',
properties: {
considerPropertyDescriptor: { type: 'boolean' },
includeCommonJSModuleExports: { type: 'boolean' },
},
additionalProperties: false,
},
],
},
{
type: 'array',
additionalItems: false,
items: [
{
type: 'object',
properties: {
considerPropertyDescriptor: { type: 'boolean' },
includeCommonJSModuleExports: { type: 'boolean' },
},
additionalProperties: false,
},
],
},
],
},
messages: {
matchProperty:
'Function name `{{funcName}}` should match property name `{{name}}`.',
matchVariable:
'Function name `{{funcName}}` should match variable name `{{name}}`.',
notMatchProperty:
'Function name `{{funcName}}` should not match property name `{{name}}`.',
notMatchVariable:
'Function name `{{funcName}}` should not match variable name `{{name}}`.',
},
},
'func-names': {
type: 'suggestion',
docs: {
description: 'require or disallow named `function` expressions',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/func-names',
},
schema: {
definitions: { value: { enum: ['always', 'as-needed', 'never'] } },
items: [
{ $ref: '#/definitions/value' },
{
type: 'object',
properties: { generators: { $ref: '#/definitions/value' } },
additionalProperties: false,
},
],
},
messages: {
unnamed: 'Unexpected unnamed {{name}}.',
named: 'Unexpected named {{name}}.',
},
},
'func-style': {
type: 'suggestion',
docs: {
description:
'enforce the consistent use of either `function` declarations or expressions',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/func-style',
},
schema: [
{ enum: ['declaration', 'expression'] },
{
type: 'object',
properties: {
allowArrowFunctions: { type: 'boolean', default: false },
},
additionalProperties: false,
},
],
messages: {
expression: 'Expected a function expression.',
declaration: 'Expected a function declaration.',
},
},
'function-paren-newline': {
type: 'layout',
docs: {
description: 'enforce consistent line breaks inside function parentheses',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/function-paren-newline',
},
fixable: 'whitespace',
schema: [
{
oneOf: [
{ enum: ['always', 'never', 'consistent', 'multiline'] },
{
type: 'object',
properties: { minItems: { type: 'integer', minimum: 0 } },
additionalProperties: false,
},
],
},
],
messages: {
expectedBefore: "Expected newline before ')'.",
expectedAfter: "Expected newline after '('.",
unexpectedBefore: "Unexpected newline before '('.",
unexpectedAfter: "Unexpected newline after ')'.",
},
},
'generator-star-spacing': {
type: 'layout',
docs: {
description:
'enforce consistent spacing around `*` operators in generator functions',
category: 'ECMAScript 6',
recommended: false,
url: 'https://eslint.org/docs/rules/generator-star-spacing',
},
fixable: 'whitespace',
schema: [
{
oneOf: [
{ enum: ['before', 'after', 'both', 'neither'] },
{
type: 'object',
properties: {
before: { type: 'boolean' },
after: { type: 'boolean' },
named: {
oneOf: [
{ enum: ['before', 'after', 'both', 'neither'] },
{
type: 'object',
properties: {
before: { type: 'boolean' },
after: { type: 'boolean' },
},
additionalProperties: false,
},
],
},
anonymous: {
oneOf: [
{ enum: ['before', 'after', 'both', 'neither'] },
{
type: 'object',
properties: {
before: { type: 'boolean' },
after: { type: 'boolean' },
},
additionalProperties: false,
},
],
},
method: {
oneOf: [
{ enum: ['before', 'after', 'both', 'neither'] },
{
type: 'object',
properties: {
before: { type: 'boolean' },
after: { type: 'boolean' },
},
additionalProperties: false,
},
],
},
},
additionalProperties: false,
},
],
},
],
messages: {
missingBefore: 'Missing space before *.',
missingAfter: 'Missing space after *.',
unexpectedBefore: 'Unexpected space before *.',
unexpectedAfter: 'Unexpected space after *.',
},
},
'getter-return': {
type: 'problem',
docs: {
description: 'enforce `return` statements in getters',
category: 'Possible Errors',
recommended: true,
url: 'https://eslint.org/docs/rules/getter-return',
},
fixable: null,
schema: [
{
type: 'object',
properties: { allowImplicit: { type: 'boolean', default: false } },
additionalProperties: false,
},
],
messages: {
expected: 'Expected to return a value in {{name}}.',
expectedAlways: 'Expected {{name}} to always return a value.',
},
},
'global-require': {
type: 'suggestion',
docs: {
description:
'require `require()` calls to be placed at top-level module scope',
category: 'Node.js and CommonJS',
recommended: false,
url: 'https://eslint.org/docs/rules/global-require',
},
schema: [],
messages: { unexpected: 'Unexpected require().' },
},
'guard-for-in': {
type: 'suggestion',
docs: {
description: 'require `for-in` loops to include an `if` statement',
category: 'Best Practices',
recommended: false,
url: 'https://eslint.org/docs/rules/guard-for-in',
},
schema: [],
messages: {
wrap:
'The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.',
},
},
'handle-callback-err': {
type: 'suggestion',
docs: {
description: 'require error handling in callbacks',
category: 'Node.js and CommonJS',
recommended: false,
url: 'https://eslint.org/docs/rules/handle-callback-err',
},
schema: [{ type: 'string' }],
messages: { expected: 'Expected error to be handled.' },
},
'id-blacklist': {
type: 'suggestion',
docs: {
description: 'disallow specified identifiers',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/id-blacklist',
},
schema: { type: 'array', items: { type: 'string' }, uniqueItems: true },
messages: { blacklisted: "Identifier '{{name}}' is blacklisted." },
},
'id-length': {
type: 'suggestion',
docs: {
description: 'enforce minimum and maximum identifier lengths',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/id-length',
},
schema: [
{
type: 'object',
properties: {
min: { type: 'integer', default: 2 },
max: { type: 'integer' },
exceptions: {
type: 'array',
uniqueItems: true,
items: { type: 'string' },
},
properties: { enum: ['always', 'never'] },
},
additionalProperties: false,
},
],
messages: {
tooShort: "Identifier name '{{name}}' is too short (< {{min}}).",
tooLong: "Identifier name '{{name}}' is too long (> {{max}}).",
},
},
'id-match': {
type: 'suggestion',
docs: {
description:
'require identifiers to match a specified regular expression',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/id-match',
},
schema: [
{ type: 'string' },
{
type: 'object',
properties: {
properties: { type: 'boolean', default: false },
onlyDeclarations: { type: 'boolean', default: false },
ignoreDestructuring: { type: 'boolean', default: false },
},
},
],
messages: {
notMatch:
"Identifier '{{name}}' does not match the pattern '{{pattern}}'.",
},
},
'implicit-arrow-linebreak': {
type: 'layout',
docs: {
description: 'enforce the location of arrow function bodies',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/implicit-arrow-linebreak',
},
fixable: 'whitespace',
schema: [{ enum: ['beside', 'below'] }],
messages: {
expected: 'Expected a linebreak before this expression.',
unexpected: 'Expected no linebreak before this expression.',
},
},
indent: {
type: 'layout',
docs: {
description: 'enforce consistent indentation',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/indent',
},
fixable: 'whitespace',
schema: [
{ oneOf: [{ enum: ['tab'] }, { type: 'integer', minimum: 0 }] },
{
type: 'object',
properties: {
SwitchCase: { type: 'integer', minimum: 0, default: 0 },
VariableDeclarator: {
oneOf: [
{
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
{
type: 'object',
properties: {
var: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
let: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
const: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
},
additionalProperties: false,
},
],
},
outerIIFEBody: { type: 'integer', minimum: 0 },
MemberExpression: {
oneOf: [{ type: 'integer', minimum: 0 }, { enum: ['off'] }],
},
FunctionDeclaration: {
type: 'object',
properties: {
parameters: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
body: { type: 'integer', minimum: 0 },
},
additionalProperties: false,
},
FunctionExpression: {
type: 'object',
properties: {
parameters: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
body: { type: 'integer', minimum: 0 },
},
additionalProperties: false,
},
CallExpression: {
type: 'object',
properties: {
arguments: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
},
additionalProperties: false,
},
ArrayExpression: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
ObjectExpression: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
ImportDeclaration: {
oneOf: [
{ type: 'integer', minimum: 0 },
{ enum: ['first', 'off'] },
],
},
flatTernaryExpressions: { type: 'boolean', default: false },
ignoredNodes: {
type: 'array',
items: { type: 'string', not: { pattern: ':exit$' } },
},
ignoreComments: { type: 'boolean', default: false },
},
additionalProperties: false,
},
],
messages: {
wrongIndentation:
'Expected indentation of {{expected}} but found {{actual}}.',
},
},
'indent-legacy': {
type: 'layout',
docs: {
description: 'enforce consistent indentation',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/indent-legacy',
},
deprecated: true,
replacedBy: ['indent'],
fixable: 'whitespace',
schema: [
{ oneOf: [{ enum: ['tab'] }, { type: 'integer', minimum: 0 }] },
{
type: 'object',
properties: {
SwitchCase: { type: 'integer', minimum: 0 },
VariableDeclarator: {
oneOf: [
{ type: 'integer', minimum: 0 },
{
type: 'object',
properties: {
var: { type: 'integer', minimum: 0 },
let: { type: 'integer', minimum: 0 },
const: { type: 'integer', minimum: 0 },
},
},
],
},
outerIIFEBody: { type: 'integer', minimum: 0 },
MemberExpression: { type: 'integer', minimum: 0 },
FunctionDeclaration: {
type: 'object',
properties: {
parameters: {
oneOf: [{ type: 'integer', minimum: 0 }, { enum: ['first'] }],
},
body: { type: 'integer', minimum: 0 },
},
},
FunctionExpression: {
type: 'object',
properties: {
parameters: {
oneOf: [{ type: 'integer', minimum: 0 }, { enum: ['first'] }],
},
body: { type: 'integer', minimum: 0 },
},
},
CallExpression: {
type: 'object',
properties: {
parameters: {
oneOf: [{ type: 'integer', minimum: 0 }, { enum: ['first'] }],
},
},
},
ArrayExpression: {
oneOf: [{ type: 'integer', minimum: 0 }, { enum: ['first'] }],
},
ObjectExpression: {
oneOf: [{ type: 'integer', minimum: 0 }, { enum: ['first'] }],
},
},
additionalProperties: false,
},
],
messages: {
expected: 'Expected indentation of {{expected}} but found {{actual}}.',
},
},
'init-declarations': {
type: 'suggestion',
docs: {
description:
'require or disallow initialization in variable declarations',
category: 'Variables',
recommended: false,
url: 'https://eslint.org/docs/rules/init-declarations',
},
schema: {
anyOf: [
{
type: 'array',
items: [{ enum: ['always'] }],
minItems: 0,
maxItems: 1,
},
{
type: 'array',
items: [
{ enum: ['never'] },
{
type: 'object',
properties: { ignoreForLoopInit: { type: 'boolean' } },
additionalProperties: false,
},
],
minItems: 0,
maxItems: 2,
},
],
},
messages: {
initialized:
"Variable '{{idName}}' should be initialized on declaration.",
notInitialized:
"Variable '{{idName}}' should not be initialized on declaration.",
},
},
'jsx-quotes': {
type: 'layout',
docs: {
description:
'enforce the consistent use of either double or single quotes in JSX attributes',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/jsx-quotes',
},
fixable: 'whitespace',
schema: [{ enum: ['prefer-single', 'prefer-double'] }],
messages: { unexpected: 'Unexpected usage of {{description}}.' },
},
'key-spacing': {
type: 'layout',
docs: {
description:
'enforce consistent spacing between keys and values in object literal properties',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/key-spacing',
},
fixable: 'whitespace',
schema: [
{
anyOf: [
{
type: 'object',
properties: {
align: {
anyOf: [
{ enum: ['colon', 'value'] },
{
type: 'object',
properties: {
mode: { enum: ['strict', 'minimum'] },
on: { enum: ['colon', 'value'] },
beforeColon: { type: 'boolean' },
afterColon: { type: 'boolean' },
},
additionalProperties: false,
},
],
},
mode: { enum: ['strict', 'minimum'] },
beforeColon: { type: 'boolean' },
afterColon: { type: 'boolean' },
},
additionalProperties: false,
},
{
type: 'object',
properties: {
singleLine: {
type: 'object',
properties: {
mode: { enum: ['strict', 'minimum'] },
beforeColon: { type: 'boolean' },
afterColon: { type: 'boolean' },
},
additionalProperties: false,
},
multiLine: {
type: 'object',
properties: {
align: {
anyOf: [
{ enum: ['colon', 'value'] },
{
type: 'object',
properties: {
mode: { enum: ['strict', 'minimum'] },
on: { enum: ['colon', 'value'] },
beforeColon: { type: 'boolean' },
afterColon: { type: 'boolean' },
},
additionalProperties: false,
},
],
},
mode: { enum: ['strict', 'minimum'] },
beforeColon: { type: 'boolean' },
afterColon: { type: 'boolean' },
},
additionalProperties: false,
},
},
additionalProperties: false,
},
{
type: 'object',
properties: {
singleLine: {
type: 'object',
properties: {
mode: { enum: ['strict', 'minimum'] },
beforeColon: { type: 'boolean' },
afterColon: { type: 'boolean' },
},
additionalProperties: false,
},
multiLine: {
type: 'object',
properties: {
mode: { enum: ['strict', 'minimum'] },
beforeColon: { type: 'boolean' },
afterColon: { type: 'boolean' },
},
additionalProperties: false,
},
align: {
type: 'object',
properties: {
mode: { enum: ['strict', 'minimum'] },
on: { enum: ['colon', 'value'] },
beforeColon: { type: 'boolean' },
afterColon: { type: 'boolean' },
},
additionalProperties: false,
},
},
additionalProperties: false,
},
],
},
],
messages: {
extraKey: "Extra space after {{computed}}key '{{key}}'.",
extraValue: "Extra space before value for {{computed}}key '{{key}}'.",
missingKey: "Missing space after {{computed}}key '{{key}}'.",
missingValue: "Missing space before value for {{computed}}key '{{key}}'.",
},
},
'keyword-spacing': {
type: 'layout',
docs: {
description: 'enforce consistent spacing before and after keywords',
category: 'Stylistic Issues',
recommended: false,
url: 'https://eslint.org/docs/rules/keyword-spacing',
},
fixable: 'whitespace',
schema: [
{
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
overrides: {
type: 'object',
properties: {
abstract: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
as: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
async: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
await: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
boolean: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
break: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
byte: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
case: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
catch: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
char: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
class: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},
additionalProperties: false,
},
const: {
type: 'object',
properties: {
before: { type: 'boolean', default: true },
after: { type: 'boolean', default: true },
},