Tslint: Not clear how to use .js config file instead of .json file

Created on 25 Aug 2018  路  2Comments  路  Source: palantir/tslint

Investigating this, in order to see how I can make multiple projects (Lerna mono repo) share a common lint configuration.

Could only find these hints:

Someone asked the same question on stackoverflow without a clear answer

Looking into the code apparently it uses require.resolve so either should work. Please make it clear and provide a more simple example for how to use it in this context, similar to webpack config files, jest etc.

Thanks :)

Documentation 馃尮 R.I.P. 馃尮

Most helpful comment

Ah, I think I got it now:

base-project repo with base configs such as tslint.config.js

// config/tslint.config.js
module.exports = {
  "extends": [
    "tslint:latest",
    "tslint-react",
    "tslint-config-prettier"
  ],
  "rules": {
    ...
   }
}

Extension project

// tslint.json
{
  "extends": "base-project/config/tslint.config",
  "rules": {}
}

Makes sense after all :) Please include this or similar example. Cheers!

All 2 comments

Ah, I think I got it now:

base-project repo with base configs such as tslint.config.js

// config/tslint.config.js
module.exports = {
  "extends": [
    "tslint:latest",
    "tslint-react",
    "tslint-config-prettier"
  ],
  "rules": {
    ...
   }
}

Extension project

// tslint.json
{
  "extends": "base-project/config/tslint.config",
  "rules": {}
}

Makes sense after all :) Please include this or similar example. Cheers!

馃 Beep boop! 馃憠 TSLint is deprecated 馃憟 _(#4534)_ and you should switch to typescript-eslint! 馃

馃敀 This issue is being locked to prevent further unnecessary discussions. Thank you! 馃憢

Was this page helpful?
0 / 5 - 0 ratings