Lynt Versions Save

✨ A zero config JavaScript linter with support for Typescript, Flow, and React.

v0.5.0

5 years ago

CLI

  • New --exportConfig option added (Thanks @danielpa9708).

This allows you to export the config that Lynt uses for TSLint or ESLint into your current working directory. When used with --typescript, this will create a tslint.json file in your CWD. When used without --typescript, it will create a eslintrc.json and .eslintignore in your CWD. The main purpose of exporting your configs is for usage with text editors until plugins for Lynt exist.

Rule Changes

TSLint

  • prefer-const added
  • only-arrow-functions removed
  • no-unnecessary-type-assertion removed
  • no-this-assignment removed
  • no-implicit-dependencies removed
  • no-var-requires removed
  • no-namespace removed

ESLint

  • prefer-const added
  • no-var added

Internal Changes

Split Packages

Hardcoded rules have been removed from Lynt's codebase, and shareable config packages are conditionally included in the extends field instead. The following packages now exist:

The plan is to group all of these packages together into this repo and to use something like Lerna in order to create this monorepo.

Test rewrite

Tests have been completely rewritten and improved to better cover more use cases and different options. The CLI itself is now being tested as well.

v0.4.0

5 years ago

v0.4.0

This release will allow you to override lynt's default rule configuration. Note that any rules defined as "style rules" in ESLint or TSLint are still not allowed to be used. This is to encourage users to rely on better tools when it comes to code formatting, such as Prettier.

Configuring Lynt

There has always been 3 ways to configure lynt

– Command Line arguments – Setting a lynt property in package.json – Creating a .lyntrc file in your root project folder

To customize rules, you must use one of the last 2, you cannot do so with command line arguments. You can still use the CLI for all the other configuration options if you want though.

In the examples below, I'll be using an example .lyntrc file, but everything could also be done with the package.json style as well.

The examples work for both ESLint and TSLint configuration (though obviously if TSLint is being used, you can't add ESLint rules to it or vice-versa).

Disabling default rules

You can disable rules by passing the rule name and setting its value to off or false.

.lyntrc

{
  "rules": {
    "curly": "off"
  }
}

This will remove the curly rule from lynt's default ESLint config.

Enabling extra rules

You can enable rules by passing the rule name and setting its value to on or true to use the default setting for a rule. If you want to pass something more complex, you can do that as well.

.lyntrc

{
  "rules": {
    "prefer-const": "on",
    "no-console": "on",
    "no-unused-expressions": [
      "error",
        {
          "allowShortCircuit": true
        }
    ]
  }
}

Configuration File Example

Thought it might be helpful to see a larger config file just as a reference. This config adds support for TypeScript, React, and --fix by default, as well as including some rule configuration.

.lyntrc

{
  "typescript": true,
  "react": true,
  "fix": true,
  "rules": {
    "prefer-const": "on",
    "no-unused-expression": "off"
  }
}

I'll be updating the readme soon to include this info about configuration.