Skip to content

Feat: Enhance rule set#4

Merged
Changqing-JING merged 7 commits into
wasm-ecosystem:mainfrom
xpirad:CoverMoreRules
Jun 6, 2025
Merged

Feat: Enhance rule set#4
Changqing-JING merged 7 commits into
wasm-ecosystem:mainfrom
xpirad:CoverMoreRules

Conversation

@xpirad
Copy link
Copy Markdown
Contributor

@xpirad xpirad commented Jun 2, 2025

This pull request introduces enhancement to the AssemblyScript ESLint plugin, including two new rules (no-concat-string and specify-type) to improve code quality and performance, updating the sample ESLint configuration, and other minor adjustments. Below is a breakdown of specific changes in this PR.

New Rules Added:

  • no-concat-string Rule:
    • Prohibits string concatenation inside loops to avoid performance issues caused by repeated memory allocation and garbage collection. Suggests alternatives like array.join() or string builders. [1] [2]
  • specify-type Rule:
    • Enforces explicit type annotations for variable declarations, especially for numeric types, to enhance WebAssembly type safety and performance. [1] [2]

Plugin Updates:

  • Rule Integration:
    • Added no-concat-string and specify-type to the plugin's rule set in plugins/asPlugin.ts.
  • Test Coverage:
    • Included tests for the new rules in tests/asPlugin.test.ts.

Sample ESLint Configuration:

  • Enhanced Configuration:
    • Updated sample_config/sample_eslint.config.mjs to use consistent double quotes and added new rules such as no-implicit-globals, curly, and @typescript-eslint/no-restricted-types to enforce stricter coding practices. [1] [2]

Minor Adjustments:

  • File Cleanup:
    • Removed sample_config/** from .prettierignore to ensure proper formatting of sample configuration files.
  • Updated Word List:
    • Added sonarjs to the typechecker in cspell/project-words.txt.

Comment thread docs/rules/specify-type.md Outdated
Comment thread plugins/rules/noConcatString.ts
Comment thread plugins/rules/noConcatString.ts
Comment thread docs/rules/specify-type.md Outdated
Comment thread plugins/rules/noConcatString.ts
Comment thread tests/rules/specifyType.test.ts Outdated
Comment thread docs/rules/specify-type.md Outdated
…ance is usually determined by specific hardware support)
@Changqing-JING Changqing-JING merged commit c52c2d4 into wasm-ecosystem:main Jun 6, 2025
1 check passed
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.

4 participants