mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
55 lines
1.7 KiB
JavaScript
55 lines
1.7 KiB
JavaScript
import js from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
import globals from 'globals';
|
|
|
|
export default tseslint.config(
|
|
// Ignore build output and generated artifacts.
|
|
{ ignores: ['dist', 'dev-dist', 'coverage'] },
|
|
|
|
js.configs.recommended,
|
|
|
|
// Type-aware linting for the TypeScript sources only.
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
extends: [...tseslint.configs.recommendedTypeChecked],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
globals: { ...globals.browser, __APP_VERSION__: 'readonly' },
|
|
parserOptions: {
|
|
// Type-aware linting: powers no-floating-promises, no-misused-promises, etc.
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
plugins: {
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
// Allow intentionally-unused args/vars when prefixed with _ (matches tsconfig intent).
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
],
|
|
},
|
|
},
|
|
|
|
// Tests exercise looser patterns and run in Node.
|
|
{
|
|
files: ['**/*.test.{ts,tsx}'],
|
|
languageOptions: { globals: { ...globals.node } },
|
|
},
|
|
|
|
// Plain JS config files and Node scripts (this file, scripts/*.mjs, etc.) are
|
|
// not part of the TS project — run them through the untyped ruleset only.
|
|
{
|
|
files: ['**/*.{js,mjs}'],
|
|
extends: [tseslint.configs.disableTypeChecked],
|
|
languageOptions: { globals: { ...globals.node } },
|
|
},
|
|
);
|