question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hey,

I’m adding support for TSLint, and it turns out that the code is basically exactly the same as for ESLint.

--- src/special/eslint.js	2018-08-09 13:33:55.000000000 +0100
+++ src/special/tslint.js	2018-08-09 13:45:28.000000000 +0100
@@ -101,10 +101,10 @@
 
 function checkConfig(config, rootDir) {
   const parser = wrapToArray(config.parser);
-  const plugins = wrapToArray(config.plugins).map(plugin => `eslint-plugin-${plugin}`);
+  const plugins = wrapToArray(config.plugins).map(plugin => `tslint-plugin-${plugin}`);
 
   const presets = wrapToArray(config.extends)
-    .filter(preset => preset !== 'eslint:recommended')
+    .filter(preset => preset !== 'tslint:recommended')
     .map(preset => resolvePresetPackage(preset, rootDir));
 
   const presetPackages = presets
@@ -120,9 +120,9 @@
   return lodash.union(parser, plugins, presetPackages, presetDeps);
 }
 
-export default function parseESLint(content, filename, deps, rootDir) {
+export default function parseTSLint(content, filename, deps, rootDir) {
   const basename = path.basename(filename);
-  if (/^\.eslintrc(\.json|\.js|\.yml|\.yaml)?$/.test(basename)) {
+  if (/^\.tslintrc(\.json|\.js|\.yml|\.yaml)?$/.test(basename)) {
     const config = parse(content);
     return checkConfig(config, rootDir);
   }

How would you prefer this to be done?

  1. Keep as two files with basically the same content
  2. Extract the code out to e.g. src/util/linters.js and just have a basic call in specials/*.js
  3. Just have eslint also check for tslint files/packages

Cheers 🍻

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rumplcommented, Aug 9, 2018

Go for option 2 then, less code we have the better 😃

0reactions
mnkhouricommented, Aug 13, 2018

Fixed in #266, #270 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSLint - Palantir Open Source
TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported ...
Read more >
TSLint - npm
TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors.
Read more >
TSLint - An extensible linter for the TypeScript language - GitHub
TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported ...
Read more >
TSLint - Visual Studio Marketplace
The implementation as a TypeScript server plugin enables sharing the program representation with TypeScript. This is more efficient than the ...
Read more >
Linting TypeScript with Tslint | Mashup Garage Playbook
Tslint is a tool that checks your JavaScript code for errors and code formatting issues. We encourage all projects to adopt the tslint:recommended ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found