Skip to content

Commit

Permalink
chore: format rules files
Browse files Browse the repository at this point in the history
  • Loading branch information
limtingzhi committed May 27, 2024
1 parent 6004ee7 commit 3f66bed
Show file tree
Hide file tree
Showing 9 changed files with 593 additions and 446 deletions.
236 changes: 145 additions & 91 deletions rules/core/formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,36 @@ module.exports = {
'arrow-spacing': ['error', { before: true, after: true }],
'block-spacing': ['error', 'always'],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
}],
'comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
},
],
'comma-spacing': ['error', { before: false, after: true }],
'comma-style': ['error', 'last', {
exceptions: {
ArrayExpression: false,
ArrayPattern: false,
ArrowFunctionExpression: false,
CallExpression: false,
FunctionDeclaration: false,
FunctionExpression: false,
ImportDeclaration: false,
ObjectExpression: false,
ObjectPattern: false,
VariableDeclaration: false,
NewExpression: false,
'comma-style': [
'error',
'last',
{
exceptions: {
ArrayExpression: false,
ArrayPattern: false,
ArrowFunctionExpression: false,
CallExpression: false,
FunctionDeclaration: false,
FunctionExpression: false,
ImportDeclaration: false,
ObjectExpression: false,
ObjectPattern: false,
VariableDeclaration: false,
NewExpression: false,
},
},
}],
],
'computed-property-spacing': ['error', 'never'],
'dot-location': ['error', 'property'],
'eol-last': ['error', 'always'],
Expand All @@ -39,86 +46,128 @@ module.exports = {
'function-paren-newline': ['error', 'consistent'],
'generator-star-spacing': ['error', { before: false, after: true }],
'implicit-arrow-linebreak': ['error', 'beside'],
'indent': ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
FunctionDeclaration: {
parameters: 1,
body: 1,
},
FunctionExpression: {
parameters: 1,
body: 1,
},
CallExpression: {
arguments: 1,
'indent': [
'error',
2,
{
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
FunctionDeclaration: {
parameters: 1,
body: 1,
},
FunctionExpression: {
parameters: 1,
body: 1,
},
CallExpression: {
arguments: 1,
},
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
ignoredNodes: [
'JSXElement',
'JSXElement > *',
'JSXAttribute',
'JSXIdentifier',
'JSXNamespacedName',
'JSXMemberExpression',
'JSXSpreadAttribute',
'JSXExpressionContainer',
'JSXOpeningElement',
'JSXClosingElement',
'JSXText',
'JSXEmptyExpression',
'JSXSpreadChild',
],
ignoreComments: false,
},
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
ignoredNodes: ['JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
ignoreComments: false,
}],
],
'jsx-quotes': 'off',
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'keyword-spacing': ['error', {
before: true,
after: true,
overrides: {
return: { after: true },
throw: { after: true },
case: { after: true },
'keyword-spacing': [
'error',
{
before: true,
after: true,
overrides: {
return: { after: true },
throw: { after: true },
case: { after: true },
},
},
}],
],
'line-comment-position': 'off',
'linebreak-style': ['error', 'unix'],
'lines-around-comment': 'off',
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
'max-len': ['error', 100, 2, {
ignorePattern: '^import ',
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
}],
'max-len': [
'error',
100,
2,
{
ignorePattern: '^import ',
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
'max-statements-per-line': 'off',
'multiline-ternary': 'off',
'new-parens': 'error',
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
'no-extra-parens': 'off',
'no-mixed-spaces-and-tabs': 'error',
'no-multi-spaces': ['error', {
ignoreEOLComments: false,
}],
'no-multi-spaces': [
'error',
{
ignoreEOLComments: false,
},
],
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'no-tabs': 'error',
'no-trailing-spaces': ['error', {
skipBlankLines: false,
ignoreComments: false,
}],
'no-trailing-spaces': [
'error',
{
skipBlankLines: false,
ignoreComments: false,
},
],
'no-whitespace-before-property': 'error',
'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
'object-curly-newline': ['error', {
ObjectExpression: { minProperties: 6, multiline: true, consistent: true },
ObjectPattern: { minProperties: 6, multiline: true, consistent: true },
ImportDeclaration: 'never',
ExportDeclaration: { minProperties: 6, multiline: true, consistent: true },
}],
'object-curly-newline': [
'error',
{
ObjectExpression: { minProperties: 6, multiline: true, consistent: true },
ObjectPattern: { minProperties: 6, multiline: true, consistent: true },
ImportDeclaration: 'never',
ExportDeclaration: { minProperties: 6, multiline: true, consistent: true },
},
],
'object-curly-spacing': ['error', 'always'],
'object-property-newline': ['error', {
allowAllPropertiesOnSameLine: true,
}],
'object-property-newline': [
'error',
{
allowAllPropertiesOnSameLine: true,
},
],
'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
'padded-blocks': ['error', {
blocks: 'never',
classes: 'never',
switches: 'never',
}, {
allowSingleLineBlocks: true,
}],
'padded-blocks': [
'error',
{
blocks: 'never',
classes: 'never',
switches: 'never',
},
{
allowSingleLineBlocks: true,
},
],
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: ['export', 'function', 'class', 'cjs-export'] },
Expand All @@ -130,19 +179,24 @@ module.exports = {
'semi-spacing': ['error', { before: false, after: true }],
'semi-style': ['error', 'last'],
'space-before-blocks': 'error',
'space-before-function-paren': ['error', {
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
}],
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
},
],
'space-in-parens': ['error', 'never'],
'space-infix-ops': 'error',
'space-unary-ops': ['error', {
words: true,
nonwords: false,
overrides: {
'space-unary-ops': [
'error',
{
words: true,
nonwords: false,
overrides: {},
},
}],
],
'switch-colon-spacing': ['error', { after: true, before: false }],
'template-curly-spacing': 'error',
'template-tag-spacing': ['error', 'never'],
Expand Down
9 changes: 6 additions & 3 deletions rules/core/problems.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ module.exports = {
'no-obj-calls': 'error',
'no-promise-executor-return': 'off',
'no-prototype-builtins': 'error',
'no-self-assign': ['error', {
props: true,
}],
'no-self-assign': [
'error',
{
props: true,
},
],
'no-self-compare': 'error',
'no-setter-return': 'off',
'no-sparse-arrays': 'error',
Expand Down
Loading

0 comments on commit 3f66bed

Please sign in to comment.