New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENHANCEMENT] Use a flat ESLint config file in the app
blueprint
#10451
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<% if (!typescript) { %>import babelEslintParser from '@babel/eslint-parser'; | ||
<% } %>import eslint from '@eslint/js'; | ||
import pluginEmberRecommended from 'eslint-plugin-ember/configs/recommended'; | ||
import pluginNode from 'eslint-plugin-n'; | ||
import pluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
import pluginQunitRecommended from 'eslint-plugin-qunit/configs/recommended'; | ||
<% if (typescript) { %>import typescriptEslint from 'typescript-eslint'; | ||
<% } else { %>import globals from 'globals'; | ||
<% } %> | ||
/** @type {import('eslint').Linter.FlatConfig[]} */ | ||
export default [<% if (!typescript) { %> | ||
// Babel: | ||
{ | ||
languageOptions: { | ||
globals: globals.browser, | ||
parser: babelEslintParser, | ||
parserOptions: { | ||
babelOptions: { | ||
plugins: [ | ||
[ | ||
'@babel/plugin-proposal-decorators', | ||
{ decoratorsBeforeExport: true }, | ||
], | ||
], | ||
}, | ||
ecmaVersion: 'latest', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
requireConfigFile: false, | ||
sourceType: 'module', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sourceType is determined by the package.json |
||
}, | ||
}, | ||
}, | ||
<% } %> | ||
// ESLint: | ||
eslint.configs.recommended, | ||
|
||
// Ember: | ||
...pluginEmberRecommended, | ||
<% if (typescript) { %> | ||
// TypeScript: | ||
...typescriptEslint.configs.recommended.map((config) => ({ | ||
...config, | ||
files: ['**/*.ts'], | ||
})), | ||
<% } %> | ||
// Node: | ||
{ | ||
...pluginNode.configs['flat/recommended-script'], | ||
files: [ | ||
'blueprints/*/index.js', | ||
'config/**/*.js', | ||
'lib/*/index.js', | ||
'server/**/*.js', | ||
'*.js', | ||
], | ||
}, | ||
{ | ||
...pluginNode.configs['flat/recommended-module'], | ||
files: ['*.mjs'], | ||
}, | ||
|
||
// Qunit: | ||
{ | ||
...pluginQunitRecommended, | ||
files: ['tests/**/*-test.{js,ts}'], | ||
}, | ||
|
||
// Prettier: | ||
pluginPrettierRecommended, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo, we should probably include gjs/gts support in here by default, since there is no cost to having config for gjs/gts if folks aren't using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide a todo list for this? I know the recommended flat config of eslint-plugin-ember already brings in the correct parser, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to use
recommended-gjs
orrecommended-gts
when needed it seems?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and set the parser, per the readme here:
https://github.com/ember-cli/eslint-plugin-ember?tab=readme-ov-file#gtsgjs
this'll actually solve a lot of problems folks have had with gjs/gts, because there are bugs when a parser is specified outside of overrides with the non-flat config