Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
JoshMock
left a comment
There was a problem hiding this comment.
Thanks for this contribution, @johns70! I left a few comments and suggestions.
I'll also note that you've dropped the comments disabling no-misused-new, no-extraneous-class and no-unused-vars from many of the code-generated files, but in some of those files the no-unused-vars disable is still present. Because those code files are 100% generated from the Elasticsearch spec, it will be easier to be consistent with what disable rules are kept at the top of each file.
eslint.config.mjs
Outdated
| }) | ||
|
|
||
| export default [ | ||
| // Cargamos la configuración de neostandard |
There was a problem hiding this comment.
Since this repo targets English as its primary language, please ensure any comments are in English as well.
eslint.config.mjs
Outdated
| // Archivos a IGNORAR (Esto limpia la carpeta src/api) | ||
| { | ||
| ignores: [ | ||
| 'src/api/**', |
There was a problem hiding this comment.
While ignoring src/api/ seems helpful, we do want neostandard or eslint to auto-fix simple linting issues when these files are regenerated from the specification; the code generator does its best to output files in a consistent format but some rules around whitespace, line breaks, etc. are fixed by the linter before generated code is committed.
voxpelli
left a comment
There was a problem hiding this comment.
Some comments from my phone on my way to work 🙂
Thanks for the effort!
eslint.config.mjs
Outdated
| { | ||
| plugins: { | ||
| // Esto extrae el plugin de la base para que las reglas de abajo funcionen | ||
| '@typescript-eslint': baseConfig.find(c => c.plugins?.['@typescript-eslint'])?.plugins['@typescript-eslint'] |
There was a problem hiding this comment.
We export the plugins for convenience, use that instead: https://github.com/neostandard/neostandard#usage-of-exported-plugin
eslint.config.mjs
Outdated
|
|
||
| // Archivos a IGNORAR (Esto limpia la carpeta src/api) | ||
| { | ||
| ignores: [ |
There was a problem hiding this comment.
You can specify this as an ignores option to Neostandard: https://github.com/neostandard/neostandard?tab=readme-ov-file#configuration-options
package.json
Outdated
| "@types/split2": "4.2.3", | ||
| "@types/stoppable": "1.1.3", | ||
| "@typescript-eslint/eslint-plugin": "^8.56.1", | ||
| "@typescript-eslint/parser": "^8.56.1", |
There was a problem hiding this comment.
Do not add these directly, you must use the ones included in neostandard due to how ESLint handles deduping in configs
package.json
Outdated
| "license-checker": "25.0.1", | ||
| "minimist": "1.2.8", | ||
| "ms": "2.1.3", | ||
| "neostandard": "^0.12.2", |
There was a problem hiding this comment.
You can upgrade to version 0.13.0 now 🥳
eslint.config.mjs
Outdated
| ts: true | ||
| }) | ||
|
|
||
| export default [ |
There was a problem hiding this comment.
Consider using defineConfig here: neostandard/neostandard#308
eslint.config.mjs
Outdated
| { | ||
| files: ['**/*.ts', '**/*.cts', '**/*.mts', '**/*.tsx'], | ||
| rules: { | ||
| 'import-x/export': 'off' |
| // Esto extrae el plugin de la base para que las reglas de abajo funcionen | ||
| '@typescript-eslint': baseConfig.find(c => c.plugins?.['@typescript-eslint'])?.plugins['@typescript-eslint'] | ||
| }, | ||
| rules: { |
There was a problem hiding this comment.
I would recommend adding a comment on each rule change describing why it's necessary and/or better. This helps both project owners and us Neostandard maintainers.
package.json
Outdated
| "test:integration": "npm run test:integration-build && env tap run --jobs=1 --reporter=junit --reporter-file=report-junit.xml generated-tests/", | ||
| "lint": "ts-standard src", | ||
| "lint:fix": "ts-standard --fix src", | ||
| "lint": "eslint .", |
There was a problem hiding this comment.
| "lint": "eslint .", | |
| "lint": "eslint", |
This is enough nowadays
|
Hello, I hope you are well, thank you for the corrections and the advice, my apologies for the inconvenience, I will make the change to the code right now |
|
A quick question: since neostandard 0.13 no longer provides the import/export rule, ESLint now throws Definition for rule 'import/export' was not found for the files generated in src/api. Can I remove the /* eslint-disable import/export */ comments from the generated files, or re-add the plugin in the configuration? @voxpelli |
|
@johns70 Remove the disable comments 👍 |
|
I hope you’re doing well. First of all, I want to apologize for how long it has taken me to make progress on this task; I haven’t had much time, and I try to use the minutes I have to move forward with my responsibilities. This task is very important to me. The purpose of this message is to share some difficulties I’ve encountered with the linter regarding the auto-generated code in the lib and esm folders. I’ve noticed that every time I run npm run test or npm run build, the files in lib and esm are regenerated automatically (I assume this is due to rimraf or another build mechanism, especially when running tests). Because of this, when I try to use npx eslint . --fix, many style errors reappear—particularly indentation, semi, camelcase, and no-void. The --fix option cannot preserve changes in files that are regenerated. So far, the only viable solutions I’ve found are: Run npx eslint . --fix within the test script so that the auto-generated code is formatted automatically before running tests. Completely ignore these folders in the ignore, although I’m somewhat hesitant because this could hide unexpected errors or break project consistency. I’m not sure if I’m missing something in the Neostandard documentation that allows the linter to be permissive enough in certain cases with auto-generated code syntax. So far, I haven’t found another solution that is consistent and reliable. My main question: is --fix intended to apply only to src files, or should it also work on generated code? And if it is expected to work on generated files, is there a recommended way to integrate it without having to ignore entire folders or run eslint --fix inside the tests? Thank you for your time and guidance. Best regards, |
This is the correct approach. We only need linting to cover code in |
@JoshMock and @margaretjgu @voxpelli 🙏
Hello! This is one of the few contributions I have made as a Junior. I did problem #2920 of moving the project from ts-standard to neostandard to support ESLint 9.
I set up the new eslint.config.mjs file and made sure to ignore the src/api/ folder as the guide says. I also fixed some warnings in the tests (like the descriptions of Symbol() and some any types) so that the linter would have 0 errors.
I reviewed everything with npm run test:unit and all 613 tests passed. I hope everything is correct!

Here is a screenshot of the tests passing locally: