has anyone else had trouble with linting not worki...
# help
s
has anyone else had trouble with linting not working in SST projects that are TS-based? it seems to totally ignore my
.eslintrc.json
t
I turn off linting so not sure. I think I did see an issue that this isn't working
s
hmm.. wait ,do I need one
.eslintrc.json
per yarn workspace?
t
I do question sst handling linting on its own, seems like an overreach to me but maybe people find it useful to have it out of the box
I'm not sure
s
well, I’m talking about VS Code linting
a
It’s nice to have it out of the box, it took me a lot of time to do with SLS.
SST has all integrated, easy to start.
t
Oh vscode probably isn't aware of the eslint config
a
Yeah I also have issues with VS linter, because it lints different things compared to SST.
s
I actually don’t like using
.eslintrc.json
. if I could choose, I’d rather SST do nothing with ESLint, and I can just set it up myself manually
a
You can disable it from the
sst
json file.
s
I think the problem is here somewhere:
Copy code
"parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint"],
  "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
it’s hard to tell if SST has already installed these packages or not
a
Yeah I agree, it’s not transparent.
s
ok, so when I run
yarn start
, it’s using my eslint config just fine. I did a test:
Copy code
14:16  warning  Expected '===' and instead saw '=='  eqeqeq
in VS Code, though, it’s not getting picked up. so I’ll have to figure that out
t
vscode probably doesn't know where to find the SST eslint file
s
it’s at root level. it should. lemme check a .js file instead of .ts and see if that makes a difference
nope
so it’s not the eslint config file that’s the problem. something else
I even made my own
.eslintrc.js
and that doesn’t work
a
Let me know if you figure how to configure vscode.
s
I mean, linting works great in VS Code in my other projects
a
Yeah.
s
I have a hunch. gonna try something
makes no sense. I have these dev dependencies in my project:
Copy code
"@typescript-eslint/eslint-plugin": "^4.30.0",
    "@typescript-eslint/parser": "^4.30.0",
    "eslint": "^7.32.0",
it’s everything VS Code would need, based on the eslintrc
a fresh SST project (TypeScript) also does not work. it should
there should be zero setup on VS Code’s end, other than having the ESLint extension, which I do
a
😩
s
it must have to do with yarn workspaces.. ? in a fresh SST project, once I add an .eslintrc.json file and add
eslint
,
@typescript-eslint/eslint-plugin@latest
and
@typescript-eslint/parser@latest
to the project, linting in VS Code works great
a
Maybe.
s
seems to be an issue with the ESLint extension for VS Code 😕 related to workspaces/monorepos
a
Makes sense.
Glad I’m not the only here then.
Hhaha.
s
oh wait!
@Adrián Mouly try this:
yarn add -D eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser
and make sure your root level
.eslintrc.json
includes those properly:
Copy code
"root": true,
  "env": { "node": true },
  "parserOptions": { "ecmaVersion": 2020 },
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint"],
  "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
that actually worked for me.
a
ok.
s
(and reload VS Code of course)