mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 08:30:39 +00:00
lint: fix eslint indentation for switch cases (#2520)
also trying to preserve call indentations, but afraid its not exactly the same, but fairly close
This commit is contained in:
+3
-5
@@ -25,12 +25,9 @@ export const rules = {
|
||||
'@stylistic/curly-newline': ['error', 'always'],
|
||||
'@stylistic/object-curly-spacing': ['error', 'always'],
|
||||
'@stylistic/indent': ['error', 4, {
|
||||
ignoredNodes: [
|
||||
'CallExpression',
|
||||
'NewExpression',
|
||||
],
|
||||
SwitchCase: 1,
|
||||
CallExpression: {
|
||||
arguments: 4,
|
||||
arguments: 1,
|
||||
},
|
||||
}],
|
||||
'@stylistic/indent-binary-ops': ['error', 4],
|
||||
@@ -38,6 +35,7 @@ export const rules = {
|
||||
'@stylistic/semi': ['error', 'always'],
|
||||
'@stylistic/quotes': ['error', 'single', { 'avoidEscape': true }],
|
||||
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
||||
'@stylistic/function-paren-newline': ['error', 'multiline-arguments'],
|
||||
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
|
||||
'@stylistic/space-before-function-paren': 'error',
|
||||
'@stylistic/key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],
|
||||
|
||||
@@ -125,6 +125,8 @@ export default {
|
||||
const closeParen = sourceCode.getLastToken(node, token => token.value === ')');
|
||||
|
||||
if ( !openParen || !closeParen ) return;
|
||||
// Defer multi-line call/new formatting to stylistic paren/argument rules.
|
||||
if ( openParen.loc.start.line !== closeParen.loc.end.line ) return;
|
||||
|
||||
const afterOpen = sourceCode.getTokenAfter(openParen);
|
||||
const beforeClose = sourceCode.getTokenBefore(closeParen);
|
||||
@@ -201,4 +203,4 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user