mirror of
https://github.com/HeyPuter/puter.git
synced 2025-12-20 04:19:59 -06:00
conf: add block in eslint.config.js for extensions
This commit is contained in:
committed by
KernelDeimos
parent
353cf397cb
commit
62e77a15a2
106
eslint.config.js
106
eslint.config.js
@@ -16,6 +16,112 @@ export default defineConfig([
|
||||
files: ['src/backend/**/*.{js,mjs,cjs}'],
|
||||
languageOptions: { globals: globals.node },
|
||||
rules: {
|
||||
'no-unused-vars': ['error', {
|
||||
'vars': 'all',
|
||||
'args': 'after-used',
|
||||
'caughtErrors': 'all',
|
||||
'ignoreRestSiblings': false,
|
||||
'ignoreUsingDeclarations': false,
|
||||
'reportUsedIgnorePattern': false,
|
||||
'argsIgnorePattern': '^_',
|
||||
'caughtErrorsIgnorePattern': '^_',
|
||||
'destructuredArrayIgnorePattern': '^_',
|
||||
|
||||
}],
|
||||
curly: ['error', 'multi-line'],
|
||||
'@stylistic/curly-newline': ['error', 'always'],
|
||||
'@stylistic/object-curly-spacing': ['error', 'always'],
|
||||
'@stylistic/indent': ['error', 4, {
|
||||
CallExpression: {
|
||||
arguments: 4,
|
||||
},
|
||||
}],
|
||||
'@stylistic/indent-binary-ops': ['error', 4],
|
||||
'@stylistic/array-bracket-newline': ['error', 'consistent'],
|
||||
'@stylistic/semi': ['error', 'always'],
|
||||
'@stylistic/quotes': 'off',
|
||||
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
||||
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
|
||||
'@stylistic/space-before-function-paren': ['error', { 'anonymous': 'never', 'named': 'never', 'asyncArrow': 'always', 'catch': 'always' }],
|
||||
'@stylistic/key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],
|
||||
'@stylistic/keyword-spacing': ['error', { 'before': true, 'after': true }],
|
||||
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
|
||||
'@stylistic/comma-spacing': ['error', { 'before': false, 'after': true }],
|
||||
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
||||
'@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
|
||||
'@stylistic/dot-location': ['error', 'property'],
|
||||
'@stylistic/space-infix-ops': ['error'],
|
||||
'no-undef': 'error',
|
||||
'custom/control-structure-spacing': 'error',
|
||||
'@stylistic/no-trailing-spaces': 'error',
|
||||
|
||||
},
|
||||
extends: ['js/recommended'],
|
||||
plugins: {
|
||||
js,
|
||||
'@stylistic': stylistic,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['extensions/**/*.{js,mjs,cjs}'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
extension: 'readonly',
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-unused-vars': ['error', {
|
||||
'vars': 'all',
|
||||
'args': 'after-used',
|
||||
'caughtErrors': 'all',
|
||||
'ignoreRestSiblings': false,
|
||||
'ignoreUsingDeclarations': false,
|
||||
'reportUsedIgnorePattern': false,
|
||||
'argsIgnorePattern': '^_',
|
||||
'caughtErrorsIgnorePattern': '^_',
|
||||
'destructuredArrayIgnorePattern': '^_',
|
||||
|
||||
}],
|
||||
curly: ['error', 'multi-line'],
|
||||
'@stylistic/curly-newline': ['error', 'always'],
|
||||
'@stylistic/object-curly-spacing': ['error', 'always'],
|
||||
'@stylistic/indent': ['error', 4, { CallExpression: { arguments: 4 } }],
|
||||
'@stylistic/indent-binary-ops': ['error', 4],
|
||||
'@stylistic/array-bracket-newline': ['error', 'consistent'],
|
||||
'@stylistic/semi': ['error', 'always'],
|
||||
'@stylistic/quotes': ['error', 'single'],
|
||||
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
||||
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
|
||||
'@stylistic/space-before-function-paren': ['error', { 'anonymous': 'never', 'named': 'never', 'asyncArrow': 'always', 'catch': 'always' }],
|
||||
'@stylistic/key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],
|
||||
'@stylistic/keyword-spacing': ['error', { 'before': true, 'after': true }],
|
||||
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
|
||||
'@stylistic/comma-spacing': ['error', { 'before': false, 'after': true }],
|
||||
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
||||
'@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
|
||||
'@stylistic/dot-location': ['error', 'property'],
|
||||
'@stylistic/space-infix-ops': ['error'],
|
||||
'no-undef': 'error',
|
||||
'custom/control-structure-spacing': 'error',
|
||||
'@stylistic/no-trailing-spaces': 'error',
|
||||
|
||||
},
|
||||
extends: ['js/recommended'],
|
||||
plugins: {
|
||||
js,
|
||||
'@stylistic': stylistic,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.{js,mjs,cjs}'],
|
||||
ignores: [
|
||||
'src/backend/**/*.{js,mjs,cjs}',
|
||||
'extensions/**/*.{js,mjs,cjs}',
|
||||
],
|
||||
languageOptions: { globals: globals.browser },
|
||||
rules: {
|
||||
|
||||
'no-unused-vars': ['error', {
|
||||
'vars': 'all',
|
||||
'args': 'after-used',
|
||||
|
||||
@@ -23,6 +23,14 @@ async function validateConfig() {
|
||||
console.error('❌ ESLint configuration error (backend):', error.message);
|
||||
exitWithError = true;
|
||||
}
|
||||
|
||||
try {
|
||||
const eslint = new ESLint();
|
||||
await eslint.lintText('', { filePath: 'extensions/**/*.js' });
|
||||
} catch (error) {
|
||||
console.error('❌ ESLint configuration error (extensions):', error.message);
|
||||
exitWithError = true;
|
||||
}
|
||||
|
||||
if ( exitWithError ) {
|
||||
console.log('\x1B[36;1mYou should edit eslint.config.js to resolve this issue.\x1B[0m');
|
||||
|
||||
Reference in New Issue
Block a user