ci: setup eslint workflow#231
Conversation
| }, | ||
| ], | ||
|
|
||
| '@typescript-eslint/array-type': 'off', |
There was a problem hiding this comment.
Technically a lot of these are auto-fixable, but I wanted to keep this PR as tightly-scoped to eslint changes as I could. Cleanup can be done in follow-ups.
0152f11 to
415e6e0
Compare
81287e3 to
61f8015
Compare
serhalp
left a comment
There was a problem hiding this comment.
Thank you! Feel free to choose how you want to divide up follow-ups in separate PRs
| // @ts-check | ||
| import * as path from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { includeIgnoreFile } from '@eslint/compat' |
There was a problem hiding this comment.
| import { includeIgnoreFile } from '@eslint/compat' |
This is a brand new repo, so I think it would be better to avoid using legacy compat stuff if we can help it. I'll leave another suggestion change below with how to do that.
| ...temporarySuppressions, | ||
|
|
||
| // Must be last | ||
| prettier, |
There was a problem hiding this comment.
https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files
It should just be taking the contents of .gitignore:
node_modules
.env
.DS_Store
.netlify
coverage
.eslintcache
.cache
.vscode
.fleet
and massaging it into an array of glob patterns (slightly different than ignore file patterns):
| prettier, | |
| prettier, | |
| { | |
| ignores: [ | |
| '.DS_Store', | |
| '.cache/', | |
| '.eslintcache', | |
| '.netlify/', | |
| '.vscode/', | |
| 'coverage/', | |
| ], | |
| } |
(I also removed some irrelevant/unused ones)
There was a problem hiding this comment.
Will aim to do this in a follow-up, ideally this is a programatically generated list
There was a problem hiding this comment.
🤔 how could it be generated? in any case, I think the code suggestion I made should work as is
|
|
||
| export default tseslint.config( | ||
| // Global rules and configuration | ||
| includeIgnoreFile(path.resolve(__dirname, '.gitignore')), |
There was a problem hiding this comment.
| includeIgnoreFile(path.resolve(__dirname, '.gitignore')), |
| { | ||
| languageOptions: { | ||
| parserOptions: { | ||
| project: ['./tsconfig.base.json', './packages/*/tsconfig.json'], |
There was a problem hiding this comment.
It looks like this is actually dead code. The intent with a .base file is usually to be referenced in extends in each of the tsconfig.json files, but none of them do 😢.
| project: ['./tsconfig.base.json', './packages/*/tsconfig.json'], | |
| project: ['./packages/*/tsconfig.json'], |
I'll fix that in my PR where I fix the issue with not type-checking test/ dirs.
| { | ||
| rules: { | ||
| 'n/no-extraneous-import': 'off', | ||
| 'n/no-extraneous-require': 'off', | ||
| 'n/no-missing-import': 'off', | ||
| 'n/no-missing-require': 'off', | ||
| 'n/no-unpublished-import': 'off', | ||
| 'n/no-unpublished-require': 'off', | ||
| }, | ||
| }, |
There was a problem hiding this comment.
| { | |
| rules: { | |
| 'n/no-extraneous-import': 'off', | |
| 'n/no-extraneous-require': 'off', | |
| 'n/no-missing-import': 'off', | |
| 'n/no-missing-require': 'off', | |
| 'n/no-unpublished-import': 'off', | |
| 'n/no-unpublished-require': 'off', | |
| }, | |
| }, |
AFAICT this was some sort of tech debt shortcut specifically to the repo you copied this from that doesn't apply here. In fact I think these are the very rules that would have prevented undeclared dependencies.
Feel free to tackle this in a separate PR though!
There was a problem hiding this comment.
... although ooh actually, let's keep the two no-unpublished rules off and leave a comment that that's covered by publint
There was a problem hiding this comment.
Marking this as a follow-up item
| // `interface` and `type` have different use cases, allow both | ||
| '@typescript-eslint/consistent-type-definitions': 'off', |
There was a problem hiding this comment.
😶 For the record I disagree, but I know this is someone else's copy-pasted opinion and I won't bother elaborating—this isn't worth bikeshedding on, so leaving the rule off to enforce nothing seems reasonable.
There was a problem hiding this comment.
Feel free to remove in a follow-up!
| "forceConsistentCasingInFileNames": true, | ||
| "strict": true, | ||
| "skipLibCheck": true, | ||
| "typeRoots": ["node_modules/@types", "types"] |
There was a problem hiding this comment.
if you're deleting this, please also delete packages/headers/types/.gitkeep!
netlify/cliproject as a basePart of FRB-1853