npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nevware21/grunt-eslint-ts

v0.5.1

Published

ESLint TypeScript Validation Plugin for GruntJS

Downloads

2,135

Readme

GitHub Workflow Status (main) npm version downloads

Grunt-eslint-ts provides a Grunt-compatible wrapper for running eslint using the @typescript-eslint parser for processing TypeScript files, and provides some additional options that improves the TypeScript development workflow.

Grunt-eslint-ts-plugin Features

TBD...

Unsupported Grunt features

  • Path Mapping feature as it is not supported by tsc from the command-line
  • Grunt dest target property, use the src options instead.
  • Grunt files property for identifying files to be compiled (*.ts), planned future feature (#18 - [Feature] Add support for Grunt files object)

Quickstart

Install the npm packare: npm install @nevware21/grunt-eslint-ts --save-dev

| Package | Descriptpion |---------|---------------------- | ESLint | npm install eslint --save-dev - if you don't have ESLint installed in your project, run | @typescript-eslint/eslint-plugin | npm install @typescript-eslint/eslint-plugin --save-dev - if you don't have the @typescript plugin installed | @typescript-eslint/parser | npm install @typescript-eslint/parser --save-dev - if you dont have the parser installed | eslint-plugin-security (Optional) | npm install eslint-plugin-security --save-dev - If you want to auto inject the extra security plugin | TypeScript | npm install typescript --save-dev - if you don't have TypeScript installed in your project, run | GruntJS | npm install grunt --save-dev - if you don't have GruntJS installed in your project | Grunt-Cli | npm install grunt-cli --save-dev - Suggested, if you have never used Grunt on your system

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

Mininimal

module.exports = function(grunt) {
  grunt.initConfig({
    lint: {
      default : {
        tsconfig: './tsconfig.json'
      }
    }
  });
  grunt.loadNpmTasks("@nevware21/grunt-eslint-ts");
  grunt.registerTask("default", ["lint"]);
};

Options

The options can be specified at the global options, task options or directly on the task level, with the task level values overridding any value defined in the global options

Task only level options

| Name | Type | Description |------|------|------------ | ignoreFailures | boolean | Ignore failures and continue, useful for initial linting runs for mono-repo's

Common options: Global and Task

| Name | Type | Description |------|------|------------ | parser | IESLintParser | Override the parser and plugin to use, defaults to { plugin: "@typescript-eslint"; name: "@typescript-eslint/parser" }, set to null to block the defaults from getting injected | additionalConfig | Linter.Config | Additional Config that will be used to override the base Configuration, any additionalConfig will override any defaults | rules | Linter.RulesRecord | Additional specific rules to pass as overrides | logOutput | boolean | Log the output (stdout, stderr) of the execute command eslint response | suppressWarnings | boolean | Only include errors in the output | fix | boolean | Fix all fixable errors and warnings | disableOutputFixes | boolean | When automatic fixes are request and found, ignore the fix and don't output the fixed version, useful for debugging specific fixes that don't seem correct and you have automatic fixing enabled by default | debug | boolean | Log additional debug messages some are only display with grunt verbose messages enabled | quiet | boolean | Don't output the report to the console / grunt output | outputFile | string | Output the results to the provided file | format | string | Specify the format of the eslint report, defaults to codeframe | tsconfig | string | The path to the tsConfig file to use, when specified | maxWarnings | number | If more than this number of warnings are reported failed the task | src | string | string[] | A single string or an array of source files to be "added" to the tsconfig as either files or include. When a string it assumes a single entry, there is not encoded list etc.

IEsLintParser

| Name | Type | Description |------|------|------------ | name | string | The name of the parser to use for the eslint configuration, defaults to @typescript-eslint/parser if the @typescript-eslint/parser package exists in the node_modules | plugins | string | string[] | The plugin(s) to include for the eslint configuration, defaults to @typescript-eslint if the @typescript-eslint parser / plugin package exists in the node_modules, when the plugin is detected this also injects the plugin:@typescript-eslint/recommended rules extension (This may change in a future release to be a configuration). | parserOptions | Linter.ParserOptions | Additional parser options to apply for the eslint configuration

eslint-plugin-security

When the eslint-plugin-security package is detected in the node_modules this will be automatically injected into the eslint configuration during linting with the plugin:security/recommended rules. (This may change in a future release to be a configuration)

Example showing some option combinations

module.exports = function(grunt) {
  grunt.initConfig({
    "lint": {
        options: {
            format: "codeframe",
            suppressWarnings: false,
            debug: true,
            logOutput: true,
            failNoFiles: false          // Defaults to `true` linting will fail if no files are configured
        },
        "shared": {
            tsconfig: "./shared/tsconfig.json",
            ignoreFailures: true,
            src: [
                // Adds extra source files above those listed in the tsconfig.json
                './shared/src/**/*.ts'
            ]
        },
        "ts_plugin": {
            tsconfig: "./ts-plugin/tsconfig.json",
            ignoreFailures: true
        },
        "eslint_ts": {
            tsconfig: "./eslint-ts-plugin/tsconfig.json",
            ignoreFailures: true
        },
        "shared-fix": {
            // You can specify the options, either in an options object like there or directly in the task
            // definition like those above
            options: {
                tsconfig: "./shared/tsconfig.json",
                fix: true,
                src: [
                    './shared/src/**/*.ts'
                ]                
            }
        },
        "ts_plugin-fix": {
            options: {
                tsconfig: "./ts-plugin/tsconfig.json",
                fix: true
            }
        },
        "eslint_ts-fix": {
            options: {
                tsconfig: "./eslint-ts-plugin/tsconfig.json",
                fix: true,
            }
        }
    }
  });

  grunt.loadNpmTasks("@nevware21/grunt-eslint-ts");
  grunt.registerTask("dolint", [ "lint:shared", "lint:ts_plugin", "lint:eslint_ts" ]);
  grunt.registerTask("lint-fix", [ "lint:shared-fix", "lint:ts_plugin-fix", "lint:eslint_ts-fix" ]);
};

Version 0.1.0 used a taskname of eslint-ts, while 0.2.0 changes the primary taskname to lint but includes an alias task eslint-ts for backward compatibility. Will likely be removed prior to v1.0.0.

Contributing

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes.

Release History

See The ChangeLog