UNPKG

eslint-plugin-decorator-position

Version:
57 lines (45 loc) 1.13 kB
/** * @import { TSESLint } from '@typescript-eslint/utils'; */ const { resolve } = require('path'); // Eslint v8+ does not have CLIEngine. const { CLIEngine: v7AndEarlier } = /** @type {{ CLIEngine?: typeof import('eslint').ESLint }} */ ( require('eslint') ); const isEslint7 = Boolean(v7AndEarlier); const esLint7Config = /** @type TSESLint.ClassicConfig.Config */ ({ root: true, parser: 'babel-eslint', parserOptions: { ecmaVersion: 2018, sourceType: 'module', ecmaFeatures: { legacyDecorators: true, }, }, env: { browser: true, es6: true, }, plugins: ['decorator-position'], }); const esLint8Config = /** @type TSESLint.ClassicConfig.Config */ ({ root: true, parser: '@babel/eslint-parser', parserOptions: { ecmaVersion: 2018, sourceType: 'module', ecmaFeatures: { legacyDecorators: true, }, babelOptions: { configFile: resolve(__dirname, '../../babel.config.cjs'), }, }, env: { browser: true, es6: true, }, plugins: ['decorator-position'], }); module.exports = isEslint7 ? esLint7Config : esLint8Config;