Skip to content

Commit

Permalink
Conditionally apply eslint parserOptions
Browse files Browse the repository at this point in the history
This removes the `parserOptions` config if we are in TypeScript mode of the blueprint. The `@typescript-eslint/parser` supports different options than the babel-eslint parser and they have sensible defaults so we don't really need to configure anything specific either.

More information about the available options: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#configuration
  • Loading branch information
Windvis committed Oct 18, 2022
1 parent e79fe7d commit 861b814
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 34 deletions.
8 changes: 4 additions & 4 deletions blueprints/app/files/.eslintrc.js
Expand Up @@ -3,14 +3,14 @@
module.exports = {
root: true,
parser: '<%= typescript ? '@typescript-eslint/parser' : 'babel-eslint' %>',
parserOptions: {
<% if (!typescript) { %> parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember'<% if (typescript) { %>, '@typescript-eslint'<% } %>],
<% } %> plugins: ['ember'<% if (typescript) { %>, '@typescript-eslint'<% } %>],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
Expand Down Expand Up @@ -45,10 +45,10 @@ module.exports = {
'./server/**/*.js',<% } else { %>
'./tests/dummy/config/**/*.js',<% } %>
],
parserOptions: {
<% if (!typescript) { %> parserOptions: {
sourceType: 'script',
},
env: {
<% } %> env: {
browser: false,
node: true,
},
Expand Down
10 changes: 0 additions & 10 deletions tests/fixtures/addon/typescript/.eslintrc.js
Expand Up @@ -3,13 +3,6 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember', '@typescript-eslint'],
extends: [
'eslint:recommended',
Expand Down Expand Up @@ -43,9 +36,6 @@ module.exports = {
'./config/**/*.js',
'./tests/dummy/config/**/*.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
Expand Down
10 changes: 0 additions & 10 deletions tests/fixtures/app/typescript-embroider/.eslintrc.js
Expand Up @@ -3,13 +3,6 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember', '@typescript-eslint'],
extends: [
'eslint:recommended',
Expand Down Expand Up @@ -43,9 +36,6 @@ module.exports = {
'./lib/*/index.js',
'./server/**/*.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
Expand Down
10 changes: 0 additions & 10 deletions tests/fixtures/app/typescript/.eslintrc.js
Expand Up @@ -3,13 +3,6 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember', '@typescript-eslint'],
extends: [
'eslint:recommended',
Expand Down Expand Up @@ -43,9 +36,6 @@ module.exports = {
'./lib/*/index.js',
'./server/**/*.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
Expand Down

0 comments on commit 861b814

Please sign in to comment.