Skip to content
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"vitest": "^1.2.2"
},
"peerDependencies": {
"@babel/eslint-parser": "^7.28.6",
"@babel/eslint-parser": "^7.28.6 || ^8.0.0",
"@typescript-eslint/parser": "*"
},
"peerDependenciesMeta": {
Expand Down
1,338 changes: 996 additions & 342 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions src/parser/gjs-gts-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@
// peer (TS-only setups don't need it), so a missing dep yields null and the JS
// path below emits a targeted error.
//
// The experimental-worker entry point runs babel in a worker and matches the
// parser ember-cli wires up for plain `.js` files in JS-only apps, so config
// discovery (decorators & friends) lines up with how the rest of the project
// is being parsed.
// Matches the parser ember-cli wires up for plain `.js` files in JS-only
// apps, so config discovery (decorators & friends) lines up with how the
// rest of the project is being parsed.
let babelParser = null;
try {
// @babel/eslint-parser < 8
babelParser = require('@babel/eslint-parser/experimental-worker');
} catch {
// optional peer; left null
try {
// @babel/eslint-parser >= 8
babelParser = require('@babel/eslint-parser');
} catch {
// optional peer; left null
}
}

/**
Expand Down Expand Up @@ -57,7 +62,7 @@
}

if (isTypescript && !typescriptParser) {
throw new Error('Please install typescript to process gts');

Check failure on line 65 in src/parser/gjs-gts-parser.js

View workflow job for this annotation

GitHub Actions / TS: rc, eslint-ts-deps: ^7

tests/parser.test.js > transform

Error: Please install typescript to process gts ❯ Module.parseForESLint src/parser/gjs-gts-parser.js:65:11 ❯ tests/parser.test.js:47:14

Check failure on line 65 in src/parser/gjs-gts-parser.js

View workflow job for this annotation

GitHub Actions / TS: rc, eslint-ts-deps: ^7

tests/eslint-directive-comments.test.js > Program.comments shape expected by ESLint consumers > .gts: directive-shaped template comments surface in Program.comments

Error: Please install typescript to process gts ❯ Module.parseForESLint src/parser/gjs-gts-parser.js:65:11 ❯ tests/eslint-directive-comments.test.js:159:21

Check failure on line 65 in src/parser/gjs-gts-parser.js

View workflow job for this annotation

GitHub Actions / TS: rc, eslint-ts-deps: ^8

tests/parser.test.js > transform

Error: Please install typescript to process gts ❯ Module.parseForESLint src/parser/gjs-gts-parser.js:65:11 ❯ tests/parser.test.js:47:14

Check failure on line 65 in src/parser/gjs-gts-parser.js

View workflow job for this annotation

GitHub Actions / TS: rc, eslint-ts-deps: ^8

tests/eslint-directive-comments.test.js > Program.comments shape expected by ESLint consumers > .gts: directive-shaped template comments surface in Program.comments

Error: Please install typescript to process gts ❯ Module.parseForESLint src/parser/gjs-gts-parser.js:65:11 ❯ tests/eslint-directive-comments.test.js:159:21

Check failure on line 65 in src/parser/gjs-gts-parser.js

View workflow job for this annotation

GitHub Actions / TS: rc, eslint-ts-deps: ^6

tests/parser.test.js > transform

Error: Please install typescript to process gts ❯ Module.parseForESLint src/parser/gjs-gts-parser.js:65:11 ❯ tests/parser.test.js:47:14

Check failure on line 65 in src/parser/gjs-gts-parser.js

View workflow job for this annotation

GitHub Actions / TS: rc, eslint-ts-deps: ^6

tests/eslint-directive-comments.test.js > Program.comments shape expected by ESLint consumers > .gts: directive-shaped template comments surface in Program.comments

Error: Please install typescript to process gts ❯ Module.parseForESLint src/parser/gjs-gts-parser.js:65:11 ❯ tests/eslint-directive-comments.test.js:159:21

Check failure on line 65 in src/parser/gjs-gts-parser.js

View workflow job for this annotation

GitHub Actions / TS: rc, eslint-ts-deps: canary

tests/parser.test.js > transform

Error: Please install typescript to process gts ❯ Module.parseForESLint src/parser/gjs-gts-parser.js:65:11 ❯ tests/parser.test.js:47:14

Check failure on line 65 in src/parser/gjs-gts-parser.js

View workflow job for this annotation

GitHub Actions / TS: rc, eslint-ts-deps: canary

tests/eslint-directive-comments.test.js > Program.comments shape expected by ESLint consumers > .gts: directive-shaped template comments surface in Program.comments

Error: Please install typescript to process gts ❯ Module.parseForESLint src/parser/gjs-gts-parser.js:65:11 ❯ tests/eslint-directive-comments.test.js:159:21
}

const filePath = options.filePath;
Expand Down
1 change: 1 addition & 0 deletions test-projects/configs/flat-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"eslint:debug-file": "pnpm eslint:with-config --print-config"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.28.6",
"@babel/plugin-proposal-decorators": "^7.23.9",
"ember-eslint-parser": "workspace:*",
Expand Down
37 changes: 37 additions & 0 deletions test-projects/gjs-babel-v8/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
plugins: [
[
'babel-plugin-ember-template-compilation',
{
compilerPath: 'ember-source/dist/ember-template-compiler.js',
enableLegacyModules: [
'ember-cli-htmlbars',
'ember-cli-htmlbars-inline-precompile',
'htmlbars-inline-precompile',
],
transforms: [],
},
],
[
'module:decorator-transforms',
{
runtime: {
import: require.resolve('decorator-transforms/runtime-esm'),
},
},
],
[
'@babel/plugin-transform-runtime',
{
absoluteRuntime: __dirname,
useESModules: true,
regenerator: false,
},
],
],

generatorOpts: {
compact: false,
},
};

32 changes: 32 additions & 0 deletions test-projects/gjs-babel-v8/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import ember from 'eslint-plugin-ember/recommended';
import babelParser from '@babel/eslint-parser';

const esmParserOptions = {
ecmaFeatures: { modules: true },
ecmaVersion: 'latest',
};

export default [
ember.configs.base,
ember.configs.gjs,
{
ignores: ['dist/', 'node_modules/', 'coverage/', '!**/.*'],
},
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
{
files: ['**/*.js'],
languageOptions: {
parser: babelParser,
},
},
{
files: ['**/*.{js,gjs}'],
languageOptions: {
parserOptions: esmParserOptions,
},
},
];
24 changes: 24 additions & 0 deletions test-projects/gjs-babel-v8/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@test-project/gjs-babel-v8",
"private": true,
"scripts": {
"test:check": "pnpm run /test:check:.*/",
"test:check:correct-handle-syntax-error": "eslint . | grep -q '26:15 error Parsing error: × Unexpected eof'",
"test:check:only-one-error": "eslint --format compact . | egrep '^[0-9]+ problem[s]*' | wc -l | grep -q 1",
"test:fix": "eslint --fix --format compact . | egrep '^[0-9]+ problem[s]*' | wc -l | grep -q 1"
},
"devDependencies": {
"@babel/core": "^8.0.1",
"@babel/eslint-parser": "^8.0.1",
"@babel/plugin-transform-runtime": "^8.0.1",
"@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.46.4",
"babel-plugin-ember-template-compilation": "^3.0.1",
"decorator-transforms": "^2.3.0",
"ember-eslint-parser": "workspace:*",
"eslint": "^10.0.0",
"eslint-formatter-compact": "^9.0.1",
"eslint-plugin-ember": "^13.3.0",
"typescript": "^5.3.3"
}
}
26 changes: 26 additions & 0 deletions test-projects/gjs-babel-v8/src/placeholer.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import qp from 'limber/helpers/qp';
import highlighted from 'limber/modifiers/highlighted';
import { service } from 'limber-ui';

const orGlimdown = (format) => format || 'glimdown';

export const Placeholder = <template>
{{#let (service "editor") as |context|}}
<label class="sr-only" for="initial-editor">
Glimmer + Markdown Code Editor
</label>

<pre
data-test-placeholder
id="initial-editor"
spellcheck="false"
class="w-full h-full px-6 py-2 font-sm font-mono text-white"
{{! @glint-ignore }}
{{highlighted context.text}}
...attributes
><code class="{{orGlimdown (qp 'format')}} hljs">{{context.text}}</code></pre>
{{/let}}
</template>;


console.log(')
1 change: 1 addition & 0 deletions test-projects/gjs-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"test:check:project:alternate": "PROJECT=tsconfig.nojs.json eslint . --max-warnings=0"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.28.6",
"@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.46.4",
Expand Down
Loading