Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion conditional-files/_ts_eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ export default defineConfig([
parser: ember.parser,
parserOptions: parserOptions.esm.ts,
},
extends: [...ts.configs.recommendedTypeChecked, ember.configs.gts],
extends: [
...ts.configs.recommendedTypeChecked,
// https://github.com/ember-cli/ember-addon-blueprint/issues/119
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I'm not comfortable linking to an issue that is closed as a not planned here like this 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's your proposal @mansona ? Leave it as-is with just a link to our issue (that then itself links to the other issues if people dig a little)? Or perhaps provide more of an inline explanation rather than links to issues? Something else?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the thing I want to see here is a full explanation of why we're doing a hack, what we're working around, and then we are able to link to any issues that explain why upstream is not going to fix this.

If we're linking to a closed issue in a file that is output into a user's newly generated app we need to explain what it means and we need to communicate a sense of reassurance as to why it's ok to have this hack here. This could be one of the first experiences that someone has with an ember app and, even though it's not great, they could reasonably decide not to use Ember for a project because of a dangling link to a closed issue in a generated file 🤷

{
...ts.configs.eslintRecommended,
files: undefined,
Comment thread
bendemboski marked this conversation as resolved.
},
ember.configs.gts,
],
},
{
files: ['tests/**/*-test.{js,gjs,ts,gts}'],
Expand Down
15 changes: 15 additions & 0 deletions tests/fixtures/lint-ts/app/lint-test-gts.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* This file is used to ensure that `eslint.config.mjs` is properly configured
* to apply `typescript-eslint`'s recommended rules to `.gts` files. It ensures
* that:
*
* - `no-undef` is disabled (otherwise the undefined symbol would cause a
* linting error)
* - `@typescript-eslint/no-unsafe-return` is enabled (otherwise the
* `eslint-disable-next-line` comment would cause a linting error)
*/
export default function () {
// @ts-expect-error testing lint
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return notDefined;
}
15 changes: 15 additions & 0 deletions tests/fixtures/lint-ts/app/lint-test-ts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* This file is used to ensure that `eslint.config.mjs` is properly configured
* to apply `typescript-eslint`'s recommended rules to `.ts` files. It ensures
* that:
*
* - `no-undef` is disabled (otherwise the undefined symbol would cause a
* linting error)
* - `@typescript-eslint/no-unsafe-return` is enabled (otherwise the
* `eslint-disable-next-line` comment would cause a linting error)
*/
export default function () {
// @ts-expect-error testing lint
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return notDefined;
}
6 changes: 6 additions & 0 deletions tests/lint.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { beforeAll, describe, it, expect } from 'vitest';

import { generateApp } from './helpers.mjs';
import fixturify from 'fixturify';

describe('linting & formatting', function () {
describe('JavaScript', function () {
Expand Down Expand Up @@ -39,6 +40,11 @@ describe('linting & formatting', function () {
flags: ['--typescript', '--pnpm'],
skipNpm: false,
});

fixturify.writeSync(
app.dir,
fixturify.readSync('./tests/fixtures/lint-ts'),
);
});

it('yields output without errors', async function (context) {
Expand Down