mirror of
https://github.com/robinraju/release-downloader.git
synced 2026-10-04 08:54:36 +03:00
* Migrate to ESM * update checks * Add a precommit hook to avoid changes to dist * Fix failure on windows * Fix failure on windows
120 lines
3.7 KiB
JavaScript
120 lines
3.7 KiB
JavaScript
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import js from '@eslint/js'
|
|
import tseslint from '@typescript-eslint/eslint-plugin'
|
|
import tsParser from '@typescript-eslint/parser'
|
|
import github from 'eslint-plugin-github'
|
|
import jest from 'eslint-plugin-jest'
|
|
import prettier from 'eslint-plugin-prettier'
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
const tsFiles = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts']
|
|
|
|
export default [
|
|
{
|
|
ignores: [
|
|
'coverage/**',
|
|
'dist/**',
|
|
'lib/**',
|
|
'node_modules/**',
|
|
'test-output/**',
|
|
'*.json',
|
|
'eslint.config.mjs',
|
|
'jest.config.js',
|
|
'rollup.config.ts'
|
|
]
|
|
},
|
|
{
|
|
...js.configs.recommended,
|
|
files: tsFiles
|
|
},
|
|
{
|
|
...github.getFlatConfigs().recommended,
|
|
files: tsFiles
|
|
},
|
|
...tseslint.configs['flat/recommended'].map(config => ({
|
|
...config,
|
|
files: config.files ?? tsFiles
|
|
})),
|
|
{
|
|
files: tsFiles,
|
|
languageOptions: {
|
|
parser: tsParser,
|
|
parserOptions: {
|
|
ecmaVersion: 2023,
|
|
sourceType: 'module',
|
|
projectService: {
|
|
allowDefaultProject: [
|
|
'eslint.config.mjs',
|
|
'jest.config.js',
|
|
'rollup.config.ts'
|
|
]
|
|
},
|
|
tsconfigRootDir: __dirname
|
|
},
|
|
globals: {
|
|
Atomics: 'readonly',
|
|
SharedArrayBuffer: 'readonly'
|
|
}
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
prettier
|
|
},
|
|
rules: {
|
|
camelcase: 'off',
|
|
'eslint-comments/no-use': 'off',
|
|
'eslint-comments/no-unused-disable': 'off',
|
|
'i18n-text/no-en': 'off',
|
|
'import/no-namespace': 'off',
|
|
'import/no-unresolved': 'off',
|
|
'import/extensions': 'off',
|
|
'no-console': 'off',
|
|
'no-unused-vars': 'off',
|
|
'func-call-spacing': ['error', 'never'],
|
|
'prettier/prettier': 'error',
|
|
'@typescript-eslint/array-type': 'error',
|
|
'@typescript-eslint/await-thenable': 'error',
|
|
'@typescript-eslint/ban-ts-comment': 'error',
|
|
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
'error',
|
|
{ accessibility: 'no-public' }
|
|
],
|
|
'@typescript-eslint/explicit-function-return-type': [
|
|
'error',
|
|
{ allowExpressions: true }
|
|
],
|
|
'@typescript-eslint/no-array-constructor': 'error',
|
|
'@typescript-eslint/no-empty-interface': 'error',
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
'@typescript-eslint/no-inferrable-types': 'error',
|
|
'@typescript-eslint/no-misused-new': 'error',
|
|
'@typescript-eslint/no-namespace': 'error',
|
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
'@typescript-eslint/no-require-imports': 'error',
|
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
'@typescript-eslint/no-unused-vars': 'error',
|
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
'@typescript-eslint/no-var-requires': 'error',
|
|
'@typescript-eslint/prefer-for-of': 'warn',
|
|
'@typescript-eslint/prefer-function-type': 'warn',
|
|
'@typescript-eslint/prefer-includes': 'error',
|
|
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
'@typescript-eslint/promise-function-async': 'error',
|
|
'@typescript-eslint/require-array-sort-compare': 'error',
|
|
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
'@typescript-eslint/unbound-method': 'error'
|
|
}
|
|
},
|
|
{
|
|
...jest.configs['flat/recommended'],
|
|
files: ['**/*.test.ts', '__tests__/**/*.ts']
|
|
}
|
|
]
|