| 
 | 1 | +/**  | 
 | 2 | + * Debugging:  | 
 | 3 | + *   https://eslint.org/docs/latest/use/configure/debug  | 
 | 4 | + *  ----------------------------------------------------  | 
 | 5 | + *  | 
 | 6 | + *   Print a file's calculated configuration  | 
 | 7 | + *  | 
 | 8 | + *     npx eslint --print-config path/to/file.js  | 
 | 9 | + *  | 
 | 10 | + *   Inspecting the config  | 
 | 11 | + *  | 
 | 12 | + *     npx eslint --inspect-config  | 
 | 13 | + *  | 
 | 14 | + */  | 
 | 15 | +import globals from 'globals';  | 
 | 16 | +import js from '@eslint/js';  | 
 | 17 | + | 
 | 18 | +import ember from 'eslint-plugin-ember/recommended';  | 
 | 19 | +import eslintConfigPrettier from 'eslint-config-prettier';  | 
 | 20 | +import qunit from 'eslint-plugin-qunit';  | 
 | 21 | +import n from 'eslint-plugin-n';  | 
 | 22 | + | 
 | 23 | +import babelParser from '@babel/eslint-parser';  | 
 | 24 | + | 
 | 25 | +const esmParserOptions = {  | 
 | 26 | +  ecmaFeatures: { modules: true },  | 
 | 27 | +  ecmaVersion: 'latest',  | 
 | 28 | +  requireConfigFile: false,  | 
 | 29 | +  babelOptions: {  | 
 | 30 | +    plugins: [  | 
 | 31 | +      ['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],  | 
 | 32 | +    ],  | 
 | 33 | +  },  | 
 | 34 | +};  | 
 | 35 | + | 
 | 36 | +export default [  | 
 | 37 | +  js.configs.recommended,  | 
 | 38 | +  eslintConfigPrettier,  | 
 | 39 | +  ember.configs.base,  | 
 | 40 | +  ember.configs.gjs,  | 
 | 41 | +  /**  | 
 | 42 | +   * Ignores must be in their own object  | 
 | 43 | +   * https://eslint.org/docs/latest/use/configure/ignore  | 
 | 44 | +   */  | 
 | 45 | +  {  | 
 | 46 | +    ignores: ['dist/', 'node_modules/', 'coverage/', '!**/.*', 'test-apps/'],  | 
 | 47 | +  },  | 
 | 48 | +  /**  | 
 | 49 | +   * https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options  | 
 | 50 | +   */  | 
 | 51 | +  {  | 
 | 52 | +    linterOptions: {  | 
 | 53 | +      reportUnusedDisableDirectives: 'error',  | 
 | 54 | +    },  | 
 | 55 | +  },  | 
 | 56 | +  {  | 
 | 57 | +    files: ['**/*.js'],  | 
 | 58 | +    languageOptions: {  | 
 | 59 | +      parser: babelParser,  | 
 | 60 | +    },  | 
 | 61 | +  },  | 
 | 62 | +  {  | 
 | 63 | +    files: ['**/*.{js,gjs}'],  | 
 | 64 | +    languageOptions: {  | 
 | 65 | +      parserOptions: esmParserOptions,  | 
 | 66 | +      globals: {  | 
 | 67 | +        ...globals.browser,  | 
 | 68 | +      },  | 
 | 69 | +    },  | 
 | 70 | +  },  | 
 | 71 | +  {  | 
 | 72 | +    files: ['tests/**/*-test.{js,gjs}'],  | 
 | 73 | +    plugins: {  | 
 | 74 | +      qunit,  | 
 | 75 | +    },  | 
 | 76 | +  },  | 
 | 77 | +  /**  | 
 | 78 | +   * CJS node files  | 
 | 79 | +   */  | 
 | 80 | +  {  | 
 | 81 | +    files: [  | 
 | 82 | +      '**/*.cjs',  | 
 | 83 | +      'config/**/*.js',  | 
 | 84 | +      'tests/dummy/config/**/*.js',  | 
 | 85 | +      'testem.js',  | 
 | 86 | +      'testem*.js',  | 
 | 87 | +      'index.js',  | 
 | 88 | +      '.prettierrc.js',  | 
 | 89 | +      '.stylelintrc.js',  | 
 | 90 | +      '.template-lintrc.js',  | 
 | 91 | +      'ember-cli-build.js',  | 
 | 92 | +    ],  | 
 | 93 | +    plugins: {  | 
 | 94 | +      n,  | 
 | 95 | +    },  | 
 | 96 | + | 
 | 97 | +    languageOptions: {  | 
 | 98 | +      sourceType: 'script',  | 
 | 99 | +      ecmaVersion: 'latest',  | 
 | 100 | +      globals: {  | 
 | 101 | +        ...globals.node,  | 
 | 102 | +      },  | 
 | 103 | +    },  | 
 | 104 | +  },  | 
 | 105 | +  /**  | 
 | 106 | +   * ESM node files  | 
 | 107 | +   */  | 
 | 108 | +  {  | 
 | 109 | +    files: ['**/*.mjs'],  | 
 | 110 | +    plugins: {  | 
 | 111 | +      n,  | 
 | 112 | +    },  | 
 | 113 | + | 
 | 114 | +    languageOptions: {  | 
 | 115 | +      sourceType: 'module',  | 
 | 116 | +      ecmaVersion: 'latest',  | 
 | 117 | +      parserOptions: esmParserOptions,  | 
 | 118 | +      globals: {  | 
 | 119 | +        ...globals.node,  | 
 | 120 | +      },  | 
 | 121 | +    },  | 
 | 122 | +  },  | 
 | 123 | +];  | 
0 commit comments