Giter Site home page Giter Site logo

parcel-plugin-tslint's Introduction

parcel-plugin-tslint NPM version shield

A Parcel plugin for running tslint.

Screenshot showing parcel-plugin-tslint output

Install

# Ensure that you have peer dependencies installed first...
npm install --save parcel-bundler typescript tslint

# ...then install the plugin.
npm install --save-dev parcel-plugin-tslint

Usage

Create a tslint.json file, per the tslint configuration docs. You can customize how the linter output is displayed by adding a custom formatter setting to the linterOptions property. Example:

"linterOptions": {
    // See https://palantir.github.io/tslint/formatters/ for full list of formatters
    "formatter": "stylish"
}

To disable linting (e.g., while making a production bundle) run with the DISABLE_PARCEL_TSLINT_PLUGIN environment variable. Example:

// package.json
...
"script" {
  "bundle": "DISABLE_PARCEL_TSLINT_PLUGIN=true parcel build src/index.html"
}

Example

Clone this repo and run npm run testWatch or see the whole thing in action in your browser here: https://codesandbox.io/s/1ryv0o467

Release Notes

  • 0.0.1 WIP
  • 0.0.2 Fix for #3 (thanks @teroyks!), upgraded to Parcel 1.11.

Dependencies

Regular

  • strip-json-comments makes it easier to parse tslint.json (which can have comments).

Peer

parcel-plugin-tslint assumes that you're already bringing the following to the party:

  • parcel-bundler 1.x (tested with 1.11)
  • tslint 5.x (tested with 5.11)
  • typescript

Dev

  • @types/node allowed IDEs such as VSCode to be aware of Node's API (i.e., to support "intellisense" features for core Node objects such as 'fs').

Contributing

See CONTRIBUTING

Credits

TODO

  • Add a mocha test that uses the bundler output checker

  • Add to https://github.com/parcel-bundler/awesome-parcel

  • Mention in fathyb/parcel-plugin-typescript#51 (comment)

  • Do a better job of detecting and reporting error if/when tslint depdendency can't be found. Exmple output:

      $ npm run serve
    
    > [email protected] serve /Users/c/projects/@clinthharris/unstated-counter
    > parcel --no-cache --no-autoinstall -p 1234 src/index.html
    
    Server running at http://localhost:1234
    ๐Ÿšจ  /Users/c/projects/@clinthharris/unstated-counter/src/index.tsx: Cannot resolve dependency './state/CounterState' at '/Users/c/projects/@clinthharris/unstated-counter/src/state/CounterState'
        at Function.Module._resolveFilename (module.js:548:15)
        at Function.Module._load (module.js:475:25)
        at Module.require (module.js:597:17)
        at require (/Users/c/projects/@clinthharris/unstated-counter/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
        at Object.<anonymous> (/Users/c/projects/@clinthharris/unstated-counter/node_modules/parcel-plugin-tslint/src/TslintAsset.js:2:16)
    

    The error says Cannot resolve dependency './state/CounterState' but it's actually coming from TslintAsset.js:2:16 which is require('tslint');

parcel-plugin-tslint's People

Contributors

clintharris avatar

Watchers

 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.