Skip to content

Commit

Permalink
Merge pull request #475 from appuniversum/chore/fix-eslint-gts-setup
Browse files Browse the repository at this point in the history
Apply the `@typescript-eslint/eslint-recommended` rules to .gts files
  • Loading branch information
Windvis authored Mar 11, 2024
2 parents 3595665 + 2052b74 commit a513a4c
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 65 deletions.
14 changes: 10 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict';

// Copied from https://github.com/ember-cli/eslint-plugin-ember/pull/2107/files
const typescriptEslintRecommendedRules =
require('@typescript-eslint/eslint-plugin').configs['eslint-recommended']
.overrides[0].rules;

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
Expand All @@ -16,11 +21,12 @@ module.exports = {
// ts files
{
files: ['**/*.{gts,ts}'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
// https://github.com/ember-cli/eslint-plugin-ember/issues/2106
// TODO: remove this when eslint-plugin-ember ships it, or when we switch to the flat config setup
...typescriptEslintRecommendedRules,

// This works around an issue in Glint https://github.com/typed-ember/glint/issues/697
// It also makes adding state to a component easier, since no other code changes would be needed.
'ember/no-empty-glimmer-component-classes': 'off',
Expand Down
4 changes: 2 additions & 2 deletions addon/components/au-alert.gts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class AuAlert extends Component<AuAlertSignature> {
@tracked isVisible = true;

get skin() {
let skin = this.args.skin;
const { skin } = this.args;

if (skin === 'info') return 'au-c-alert--info';
if (skin === 'success') return 'au-c-alert--success';
Expand All @@ -34,7 +34,7 @@ export default class AuAlert extends Component<AuAlertSignature> {
}

get size() {
let size = this.args.size;
const { size } = this.args;
if (size === 'tiny') return 'au-c-alert--tiny';
if (size === 'small') return 'au-c-alert--small';
return '';
Expand Down
112 changes: 56 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
"@types/inputmask": "^5.0.7",
"@types/qunit": "^2.19.9",
"@types/rsvp": "^4.0.8",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"broccoli-asset-rev": "^3.0.0",
"chromatic": "^6.5.4",
"concurrently": "^8.2.2",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/au-main-container-test.gts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module('Integration | Component | au-main-container', function (hooks) {
</template>,
);

let containerElement = document.querySelector(
const containerElement = document.querySelector(
MAIN_CONTAINER.CONTENT,
) as HTMLElement;
assert.notStrictEqual(
Expand Down

0 comments on commit a513a4c

Please sign in to comment.