n8n/packages/@n8n_io/eslint-config/shared.js
कारतोफ्फेलस्क्रिप्ट™ 6a35812f92
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
ci: Setup biome and pre-commit hooks for formatting (no-changelog) (#10795)
Co-authored-by: Tomi Turtiainen <[email protected]>
2024-09-17 15:10:22 +03:00

42 lines
873 B
JavaScript

/**
* @type {(dir: string, mode: 'frontend' | undefined) => import('@types/eslint').ESLint.ConfigData}
*/
module.exports = (tsconfigRootDir, mode) => {
const isFrontend = mode === 'frontend';
const parser = isFrontend ? 'vue-eslint-parser' : '@typescript-eslint/parser';
const extraParserOptions = isFrontend
? {
extraFileExtensions: ['.vue'],
parser: {
ts: '@typescript-eslint/parser',
js: '@typescript-eslint/parser',
vue: 'vue-eslint-parser',
template: 'vue-eslint-parser',
},
}
: {};
const settings = {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
'import/resolver': {
typescript: {
tsconfigRootDir,
project: './tsconfig.json',
},
},
};
return {
parser,
parserOptions: {
tsconfigRootDir,
project: ['./tsconfig.json'],
...extraParserOptions,
},
settings,
};
};