Skip to content

Linter for AssemblyScript #991

Open
Open
@MaxGraey

Description

@MaxGraey
Member

On recent bi-weekly meeting we talked about lint system. Currently we have very basic rules for ts-lint but first of all it only for internal usage and development process, secondary it pretty basic and don't cover all special cases and finally it based on ts-lint which not so powerful as eslint which already supported by typescript. So basic plan:

  1. Migrate to eslint;
  2. Add more custom rules via plugins (need further discussion);
  3. Add default preset;
  4. Publish it to npm as @assemblyscript/linter?

Activity

willemneal

willemneal commented on Dec 6, 2019

@willemneal
Contributor

Should we also consider publishing other things such as the loader with the same namespace?

MaxGraey

MaxGraey commented on Dec 6, 2019

@MaxGraey
MemberAuthor

loader already published under @assemblyscript namespace.

willemneal

willemneal commented on Dec 6, 2019

@willemneal
Contributor

Oh didn't know that. Cool!

webmaster128

webmaster128 commented on Jan 17, 2020

@webmaster128

The commit https://github.com/confio/cosmwasm/pull/118/commits/d0e1a2ca6b7eb0d3fb34aac23b225f36af25d664 contains an AssemblyScript setup with eslint + prettier + eslint-plugin-simple-import-sort. yarn lint runs the checks and yarn lint --fix fixes them, which also applies all the prettier rules. It works with the dbaeumer.vscode-eslint VSCode plugin and its auto-fixer. Feel free to borrow from that config.

cyberixae

cyberixae commented on Jul 15, 2020

@cyberixae

I imagine such linter would be used to port existing TypeScript code to make it AssemblyScript compatible. Do others believe this to be something that the linter should do? What are some of the most important rules needed? I imagine the number one feature for the config would be to blacklist incompatible type signatures or perhaps even whitelist existing ones. This config could then be used together with any existing TypeScript eslint configurations that provide stylistic and other rules that are not specific to AssemblyScript code.

mpetrunic

mpetrunic commented on Dec 30, 2020

@mpetrunic

The commit CosmWasm/cosmwasm@d0e1a2c contains an AssemblyScript setup with eslint + prettier + eslint-plugin-simple-import-sort. yarn lint runs the checks and yarn lint --fix fixes them, which also applies all the prettier rules. It works with the dbaeumer.vscode-eslint VSCode plugin and its auto-fixer. Feel free to borrow from that config.

How do you handle usage of annotations? They seems to be causing eslint parser errors

ebrensi

ebrensi commented on Feb 15, 2021

@ebrensi

I cannot run Prettier on AssemblyScript .ts files with annotations (decorators), similar to what @mpetrunic mentioned. Prettier will quit re-formatting a .ts file with

[error] src/assembly/wasm.ts: SyntaxError: Leading decorators must be attached to a class declaration

I have tried

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: decorator
// prettier-ignore

but none of these directives help.

I have resorted to commenting out all of my @inline annotations before running Prettier, and then un-commenting them afterwards. Is anyone else having this problem?

willemneal

willemneal commented on Feb 16, 2021

@willemneal
Contributor

@ebrensi Yes! Which is why I've been using eslint see sample config here.

tysonrm

tysonrm commented on Sep 29, 2021

@tysonrm

With TS to AS linter you could things like deno -run_as_wasm code.ts

6 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cyberixae@MaxGraey@mattjohnsonpint@willemneal@webmaster128

        Issue actions

          Linter for AssemblyScript · Issue #991 · AssemblyScript/assemblyscript