2024-08-13 04:53:07 +03:00
|
|
|
import antfu from '@antfu/eslint-config'
|
|
|
|
|
|
|
|
export default antfu({
|
|
|
|
type: 'lib',
|
2024-12-06 00:14:29 +03:00
|
|
|
ignores: ['e2e/runtime/*'],
|
2024-08-13 04:53:07 +03:00
|
|
|
typescript: process.env.CI
|
|
|
|
? {
|
|
|
|
tsconfigPath: 'tsconfig.json',
|
|
|
|
ignoresTypeAware: [
|
|
|
|
'.config/**/*',
|
|
|
|
'e2e/**',
|
2025-01-18 11:18:43 +03:00
|
|
|
'docs/**',
|
2024-08-13 04:53:07 +03:00
|
|
|
],
|
|
|
|
overrides: {
|
|
|
|
'ts/consistent-type-imports': 'off',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
: true,
|
|
|
|
yaml: false,
|
|
|
|
markdown: false,
|
2024-08-21 23:22:20 +03:00
|
|
|
jsonc: false,
|
2024-08-13 04:53:07 +03:00
|
|
|
linterOptions: {
|
|
|
|
reportUnusedDisableDirectives: Boolean(process.env.CI),
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
'style/indent': ['error', 4, {
|
|
|
|
offsetTernaryExpressions: false,
|
|
|
|
// the rest is from default config: https://github.com/eslint-stylistic/eslint-stylistic/blob/main/packages/eslint-plugin/configs/customize.ts
|
|
|
|
ArrayExpression: 1,
|
|
|
|
CallExpression: { arguments: 1 },
|
|
|
|
flatTernaryExpressions: false,
|
|
|
|
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
|
|
FunctionExpression: { body: 1, parameters: 1 },
|
|
|
|
ignoreComments: false,
|
|
|
|
ignoredNodes: [
|
|
|
|
'TemplateLiteral *',
|
|
|
|
'TSUnionType',
|
|
|
|
'TSIntersectionType',
|
|
|
|
'TSTypeParameterInstantiation',
|
|
|
|
'FunctionExpression > .params[decorators.length > 0]',
|
|
|
|
'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
|
|
|
|
],
|
|
|
|
ImportDeclaration: 1,
|
|
|
|
MemberExpression: 1,
|
|
|
|
ObjectExpression: 1,
|
|
|
|
outerIIFEBody: 1,
|
|
|
|
SwitchCase: 1,
|
|
|
|
VariableDeclarator: 1,
|
|
|
|
}],
|
2024-08-18 09:31:23 +03:00
|
|
|
'style/max-len': ['error', {
|
|
|
|
code: 120,
|
|
|
|
ignoreComments: true,
|
|
|
|
ignoreStrings: true,
|
|
|
|
ignoreTemplateLiterals: true,
|
|
|
|
}],
|
2024-08-19 09:25:28 +03:00
|
|
|
'unused-imports/no-unused-imports': 'error',
|
2024-08-13 04:53:07 +03:00
|
|
|
'curly': ['error', 'multi-line'],
|
|
|
|
'style/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
|
|
'node/prefer-global/process': ['error', 'always'],
|
|
|
|
'node/prefer-global/buffer': ['error', 'always'],
|
2024-08-21 11:05:07 +03:00
|
|
|
'no-restricted-globals': ['error', 'Buffer', '__dirname', 'require', 'NodeJS', 'setTimeout', 'clearTimeout'],
|
2024-08-13 04:53:07 +03:00
|
|
|
'style/quotes': ['error', 'single', { avoidEscape: true }],
|
|
|
|
'test/consistent-test-it': 'off',
|
|
|
|
'test/prefer-lowercase-title': 'off',
|
|
|
|
'test/no-identical-title': 'off',
|
|
|
|
'antfu/if-newline': 'off',
|
|
|
|
'import/no-relative-packages': 'error',
|
|
|
|
'style/max-statements-per-line': ['error', { max: 2 }],
|
|
|
|
'ts/no-redeclare': 'off',
|
|
|
|
'eslint-comments/no-unlimited-disable': 'off',
|
|
|
|
'no-cond-assign': 'off',
|
2024-08-18 09:31:23 +03:00
|
|
|
'ts/explicit-function-return-type': 'off',
|
2024-08-13 04:53:07 +03:00
|
|
|
'no-labels': 'off',
|
|
|
|
'no-restricted-syntax': 'off',
|
|
|
|
'unicorn/no-new-array': 'off',
|
|
|
|
'jsdoc/check-param-names': 'off', // todo: will fix in another iteration
|
|
|
|
'jsdoc/require-returns-description': 'off', // todo: will fix in another iteration
|
|
|
|
'ts/no-unsafe-member-access': 'off',
|
|
|
|
'ts/unbound-method': 'off',
|
2024-12-04 18:00:46 +03:00
|
|
|
'ts/strict-boolean-expressions': 'off',
|
2024-08-13 04:53:07 +03:00
|
|
|
'ts/promise-function-async': 'off',
|
|
|
|
'dot-notation': 'off',
|
|
|
|
'ts/dot-notation': 'off',
|
|
|
|
'ts/switch-exhaustiveness-check': 'off',
|
|
|
|
'ts/restrict-template-expressions': 'off',
|
|
|
|
'ts/method-signature-style': 'off',
|
2024-12-03 09:55:37 +03:00
|
|
|
'antfu/no-top-level-await': 'off',
|
|
|
|
'import/extensions': ['error', 'always', {
|
|
|
|
ignorePackages: true,
|
|
|
|
checkTypeImports: true,
|
|
|
|
}],
|
2024-08-13 04:53:07 +03:00
|
|
|
},
|
|
|
|
}, {
|
|
|
|
ignores: [
|
|
|
|
// codegen
|
|
|
|
'packages/tl/binary/rsa-keys.js',
|
|
|
|
'packages/tl/binary/reader.js',
|
|
|
|
'packages/tl/binary/writer.js',
|
|
|
|
'packages/tl/index.js',
|
|
|
|
'packages/tl/index.d.ts',
|
|
|
|
'packages/tl/*.json',
|
|
|
|
'packages/core/utils.ts',
|
|
|
|
'e2e/deno/.jsr-data',
|
|
|
|
'e2e/node/.verdaccio',
|
|
|
|
],
|
|
|
|
}, {
|
|
|
|
files: ['e2e/**', 'packages/node/**', 'packages/bun/**'],
|
|
|
|
rules: {
|
|
|
|
'no-restricted-globals': 'off',
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
files: ['packages/bun/**', 'packages/deno/**'],
|
|
|
|
rules: {
|
|
|
|
'no-restricted-imports': 'off',
|
|
|
|
'import/no-relative-packages': 'off', // common-internals is symlinked from node
|
|
|
|
},
|
|
|
|
}, {
|
2024-08-21 11:05:07 +03:00
|
|
|
files: ['**/scripts/**', '**/*.cjs', '.config/**/*'],
|
2024-08-13 04:53:07 +03:00
|
|
|
rules: {
|
|
|
|
'no-restricted-imports': 'off',
|
|
|
|
'no-restricted-globals': 'off',
|
|
|
|
'no-console': 'off',
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
files: ['packages/create-*/**', 'packages/deno/**'],
|
|
|
|
rules: {
|
|
|
|
'node/prefer-global/process': ['error', 'never'],
|
|
|
|
'node/prefer-global/buffer': ['error', 'never'],
|
|
|
|
'no-console': 'off',
|
|
|
|
},
|
2024-09-08 00:34:52 +03:00
|
|
|
}, {
|
|
|
|
files: ['e2e/**', '.config/**'],
|
|
|
|
rules: {
|
|
|
|
'import/extensions': 'off',
|
|
|
|
},
|
2024-08-13 04:53:07 +03:00
|
|
|
})
|