Skip to content

Enable more linting rules#52

Merged
AnHeuermann merged 6 commits into
OpenModelica:mainfrom
AnHeuermann:ci-lint
Jun 22, 2026
Merged

Enable more linting rules#52
AnHeuermann merged 6 commits into
OpenModelica:mainfrom
AnHeuermann:ci-lint

Conversation

@AnHeuermann

Copy link
Copy Markdown
Member

Changes

  • Switch lint rules on in eslint.config.js
  • Add linting to CI
  • Removing *.tsbuildconfig from versioning
Rule What it catches
no-unused-vars unused imports/vars/params (with ^_ ignore escape hatch)
no-unused-private-class-members dead private fields
no-explicit-any explicit any
explicit-module-boundary-types missing return types on exported functions
no-non-null-assertion ! assertions
no-unused-expressions statements with no effect

AnHeuermann and others added 6 commits June 22, 2026 12:20
Turn on @typescript-eslint/no-unused-vars (warn) with underscore-ignore
patterns for args, vars, and caught errors, so intentionally-unused
identifiers can be prefixed with `_`.

Fix the resulting warnings:
- Remove unused imports (LSP, Parser, Point, url, logger,
  ModelicaDocument)
- Remove unused GLOBAL_DECLARATION_LEAF_NODE_TYPES constant
- Prefix unused caught error with `_`
- Drop unused parser binding in server test

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Turn on @typescript-eslint/no-explicit-any (warn).

Replace `any[]` with `unknown[]` in Logger.log and the debug/info/
warn/error helpers. The logger already narrows values at runtime
(instanceof Error, typeof checks) and joins the rest with a string,
so unknown is both sufficient and safer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Turn on @typescript-eslint/explicit-module-boundary-types (warn) and
annotate the return types of all exported/public boundary functions
in the client and server.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Turn on @typescript-eslint/no-non-null-assertion (warn) and replace all
non-null assertions with explicit handling:

- Add a requireFieldName() helper in tree-sitter that throws a
  descriptive error for grammar-guaranteed fields, and use it in
  tree-sitter and resolveReference
- Return null from Analyzer.getReferenceAt when no IDENT node is found,
  matching the existing fallback path
- Check parser.parse() results for null in ModelicaDocument and throw
  on failure
- Guard the extension lookup in the test helper
- Replace assertions in tests with assert.ok() checks

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The field was assigned in the constructor but never read. Drop it
along with the constructor parameter and the capabilities value
destructured from InitializeParams.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tsconfig.tsbuildinfo is machine-generated incremental-build cache,
not source. Add *.tsbuildinfo to .gitignore and remove the tracked
client/ and server/ copies.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AnHeuermann AnHeuermann self-assigned this Jun 22, 2026
@AnHeuermann AnHeuermann enabled auto-merge (squash) June 22, 2026 11:07
@AnHeuermann AnHeuermann merged commit a471f51 into OpenModelica:main Jun 22, 2026
3 checks passed
@AnHeuermann AnHeuermann deleted the ci-lint branch June 22, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant