Coder Social home page Coder Social logo

lsvhome / tslint.msbuild Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joshuakgoldberg/tslint.msbuild

0.0 2.0 0.0 17.34 MB

An MSBuild task for running Palantir's wonderful TSLint.

Home Page: https://www.nuget.org/packages/TSLint.MSBuild

License: MIT License

JavaScript 100.00%

tslint.msbuild's Introduction

TSLint for MSBuild

NuGet Version and Downloads count

An MSBuild target for linting TypeScript code using TSLint. Get it at nuget.org.

Usage

Add this package and TSLint using your NuGet Package Manager. It should be automatically added to your project.

TSLint's default configurations are used by default. If you'd like to use your own tslint.json file, add a TSLintConfig property to your project:

<TSLintConfig>Scripts/tslint.json</TSLintConfig>

All overrideable item groups and properties are below. Read the TSLint documentation for TSLint-specific linting details.

Overrideable Item Groups

Item Group Description Default
TSLintExclude Globs of file names to exclude. (blank)
TSLintRulesDirectory Directories for user-created rules (blank)

Note that to use special characters (such as * wildcards) in TSLintExclude you must escape the special characters.

<!-- Equivalent to "typings/**/*.d.ts" -->
<TSLintExclude Include="typings/%2A%2A/%2A.d.ts" />

Overrideable Properties

Property Description Default
TSLintBreakBuildOnError Whether linting failures should break the build. false
TSLintConfig Path to a specific tslint.json. (blank)
TSLintCli Path to a TSLint CLI to run with. The highest-versioned TSLint version in the solution's packages directory.
TSLintDisabled Whether to skip running TSLint. false
TSLintExtraArgs Any extra arguments to pass to the TSLint CLI. (blank)
TSLintNodeExe Path to a Node executable to execute the runner script. The tools\node-7.3.0.exe in the package.
TSLintProject Path to a tsconfig.json file to use as a type checker project. (blank)
TSLintRunOutsideBuildingProject Whether to run even if `BuildingProject` isn't `true`. (blank)
TSLintTypeCheck Whether to enable the type checker (requires TSLintProject be set). false
TSLintVersion Glob filter for the version of TSLint to use (ignored if TSLintConfig is provided). *.*.*

Output Item Groups

Item Group Description
TSLintOutput Lines of console output from the TSLint CLI.

Output Properties

Property Description
TSLintErrorCode Exit code of the TSLint CLI.

TSLint version

The first available TSLint version in your NuGet packages directory will be used.

Errata

You can exclude .d.ts files using <TSLintExclude Include="%2A%2A/%2A.d.ts" />. MSBuild escapes * and other special characters using % and their hexadecimal value.

Development

Run the following commands to initialize your environment:

npm install

Run gulp to build. gulp test just runs tests.

Updating the version

The version number is stored both in package.json and TSLint.MSBuild.nuspec. Make sure to update it in both places.

0.X to 1.X

0.X versions ran JavaScript logic to search for TSLint, run it, and wrap the output. This was slow (running two nested Node processes, with intermediary file names in text).

1.X versions now are completely in a single MSBuild file. This is better for performance but has two downsides:

  • It no longer searches for the "highest" available TSLint version in the packages directory; instead, the first found in a file search is used.
  • The TSLintErrorSeverity flag is no longer supported (until TSLint adds support for error levels).

Furthermore, 1.0.0 removed the TSLint NuGet package dependency. You'll need to install it separately.

Why?

The original structure of TSLint.MSBuild requires multiple layers of processes calling each other, which can wreak havoc in complex managed build systems. Then, in order:

  1. MSBuild determined build settings and passed them to the JavaScript code
  2. JavaScript code determined the TSLint location and re-formulated any arguments
  3. JavaScript code ran TSLint via a spawned process, captured its output, and re-logged it
  4. MSBuild captured the (re-logged TSLint) JavaScript output and logged it

1.X unified all the logic into MSBuild, which resulted in significant performance gains, code simplification, and runtime stability. Now, in order:

  1. MSBuild determines build settings and TSLint location
  2. MSBuild runs TSLint using the packaged Node executable

0.3.X to 0.4.X

Versions 0.3.X and below manually call TSLint on individual folders, whereas 0.4.X defers to the TSLint CLI.

File a bug report if upgrading causes any issues.

1.0.3.0 to 1.0.4.0

  1. Prefer use "$(ProjectDir)node_modules.bin\tslint.cmd" (in case it exists. It may be installed with 'npm install tslint') instead "node.exe tslint-cli.js" (use same node and tslint version as used within project).
  2. Used "--format pmd" with parser instead "--format msbuild"
  3. Property "TreatWarningsAsErrors" (true|false) used as switch warn as errors or warnings

tslint.msbuild's People

Contributors

boedlen avatar esampsonite avatar mortb avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.