I've been trying to get rid of the warning:
[lint:js] To lint Gjs/Gts files please follow the setup guide at https://github.com/ember-cli/eslint-plugin-ember#gtsgjs
[lint:js] Note that this error can also happen if you have multiple versions of eslint-plugin-ember in your node_modules
I have this bit in my eslintrc overrides
{
files: ['**/*.gjs'],
parser: 'ember-eslint-parser',
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:ember/recommended-gjs',
],
}
My first step was to make sure there weren't multiple copies of eslint-plugin-ember installed. I used pnpm why -r eslint-plugin-ember. There was only one installed, the monorepo workspaces all referenced the same eslint-plugin-ember. I double-checked this by checking node_modules/.pnpm/store.
I was starting to wonder if it was even being loaded at all. In my eslint config changing parser: 'ember-eslint-parser' to parser: 'ember-eslint-parser-asdf' caused an error, so it was at least looking for the package. The next step I did was go to the source of ember-eslint-parser in my node_modules and modify directly the gjs-gts-parser.jsfile:
parseForESLint(code, options) {
throw new Error("Error thrown from `parseForESLint`");
patchTs();
/* ... */
}
Since this is the entry point for eslint to use for the parser I thought this would fail, but when I ran my pnpm lint I still received the "To lint Gjs/Gts files please follow the setup guide..." warning, and did not see the error being thrown.
After adding ember-eslint-parser with pnpm add --save-dev ember-eslint-parser and then re-running pnpm lint, I got:
0:0 error Parsing error: Error thrown from `parseForESLint`
So the throw I hacked into the ember-eslint-parser source was finally showing up. I removed my modification, and re-ran pnpm lint and no warnings or errors related to "To lint Gjs/Gts files please follow the setup guide" show up, neither via pnpm lint or in vscode.
I know this isn't the correct setup since ember-eslint-parser is a dependency of eslint-plugin-ember but I don't know why else this worked. Any ideas what's wrong in my setup?
I've been trying to get rid of the warning:
I have this bit in my eslintrc overrides
My first step was to make sure there weren't multiple copies of
eslint-plugin-emberinstalled. I usedpnpm why -r eslint-plugin-ember. There was only one installed, the monorepo workspaces all referenced the sameeslint-plugin-ember. I double-checked this by checkingnode_modules/.pnpm/store.I was starting to wonder if it was even being loaded at all. In my eslint config changing
parser: 'ember-eslint-parser'toparser: 'ember-eslint-parser-asdf'caused an error, so it was at least looking for the package. The next step I did was go to the source ofember-eslint-parserin mynode_modulesand modify directly thegjs-gts-parser.jsfile:Since this is the entry point for eslint to use for the parser I thought this would fail, but when I ran my
pnpm lintI still received the "To lint Gjs/Gts files please follow the setup guide..." warning, and did not see the error being thrown.After adding
ember-eslint-parserwithpnpm add --save-dev ember-eslint-parserand then re-runningpnpm lint, I got:So the
throwI hacked into theember-eslint-parsersource was finally showing up. I removed my modification, and re-ranpnpm lintand no warnings or errors related to "To lint Gjs/Gts files please follow the setup guide" show up, neither viapnpm lintor in vscode.I know this isn't the correct setup since
ember-eslint-parseris a dependency ofeslint-plugin-emberbut I don't know why else this worked. Any ideas what's wrong in my setup?