n8n/packages/@n8n_io/eslint-config/shared.js
कारतोफ्फेलस्क्रिप्ट™ 0333b053ee
fix: Fix the linting issue on master (no-changelog) (#5013)
* get rid of the "`parseForESLint` from parser `@typescript-eslint/parser` is invalid" errors

* fix the formatting issue
2022-12-22 09:42:07 -06:00

42 lines
881 B
JavaScript

/**
* @type {(dir: string, mode: 'frontend' | undefined) => import('@types/eslint').ESLint.ConfigData}
*/
exports.sharedOptions = (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,
};
};