Giter Site home page Giter Site logo

gradle-eslint-plugin's Introduction

Gradle ESLint Plugin

This is a Gradle plugin for running ESLint as part of your Gradle build.

Usage

  1. Install ESLint via npm: npm install eslint

  2. Add the following to your build.gradle

     buildscript {
         repositories {
             maven {
                 url "https://plugins.gradle.org/m2/"
             }
         }
         dependencies {
             classpath "gradle.plugin.com.github.scobal.eslint:gradle-eslint-plugin:1.0.5"
         }
     }
    
     apply plugin: "com.github.scobal.eslint"
    
  3. Configure ESLint to include your Javascript files in your build.gradle

     eslint {
         inputs = ["**/*.js*"]
     }
    
  4. Run gradle eslint

Configuration

The goal of this plugin is to support as fully as possible the command line interface described here:

http://eslint.org/docs/user-guide/command-line-interface

This is a list of the available options for use inside the eslint configuration block:

Option Description
executable The path to an eslint executable (default is "eslint"), eg: "/usr/bin/eslint"
yarnPath The path to yarn package manager, which will indicate to plugin to run eslint via yarn rather than directly. This can be either directory containing yarn or full path including yarn executable. Plugin has logic built to add '.cmd' suffix for the Windows Operating System, eg: "build/yarn/bin", "/usr/bin/yarn"
ignoreExitValue Boolean to ignore eslint's exit value (default is false), eg: true
inputs A list of files, directories and/or globs (default is ["src"]), eg: ["service.js", "src/controllers/", "**/*.js"]
config The path to an eslint configuration file, eg: "/home/scobal/esconfig"
noEslintrc Boolean to disable the use of .eslintrc, eg: true
env A list of environments as strings, eg: ["environment_1", "environment_2"]
ext A list of Javascript file extensions as strings, eg: [".js", ".jsx"]
global A list of global variables as strings, eg: ["global_1", "global_1"]
parser The parser to be used, eg: "espree"
parserOptions Specify parser options
cache Boolean to only check changed files, eg: true
cacheFile The path to an eslint cache file, eg: "/tmp/eslint_cache/file"
cacheLocation The path to an eslint cache file or directory, eg: "/tmp/eslint_cache"
rulesDir A list of directories with additional rules, eg: ["/eslint/rules_1", "/eslint/rules_2"]
plugin A list of plugins as strings, eg: ["plugin_1", "plugin_2"]
rule Specify rules
outputFile The path to the output file, eg: "/home/scobal/report.out"
format The format of the output file, eg: "checkstyle"

License

gradle-eslint-plugin is licensed under version 2.0 of the Apache License. See the LICENSE file for details.

Development

Build Status

gradle-eslint-plugin's People

Contributors

alexejk avatar scobal avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gradle-eslint-plugin's Issues

Cannot enable cache

The following eslint configuration

eslint {
  executable = "./node_modules/eslint/bin/eslint.js"
  config = "./.eslintrc.json"
  inputs = ["src/**/*.ts"]
  cache = true
}

results in the following error message:

> Task :eslint FAILED
Caching disabled for task ':eslint' because:
  Build cache is disabled
Task ':eslint' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Starting process 'command './node_modules/eslint/bin/eslint.js''. Working directory: /home/hakjac/wsgit/hippo Command: ./node_modules/eslint/bin/eslint.js --config ./.eslintrc.json --cache true src/**/*.ts
Successfully started process 'command './node_modules/eslint/bin/eslint.js''

Oops! Something went wrong! :(

ESLint: 6.2.2.

No files matching the pattern "true" were found.
Please check for typing mistakes in the pattern.

I believe that the cache = true option should not result in --cache true but instead just a --cache

A problem occurred starting process 'command 'eslint''

I can not run the plugin . Errors occur frequently when you start gradle eslint
A problem occurred starting process 'command 'eslint''
Here are the contents of build.gradle
plugins {
id "com.github.scobal.eslint" version "1.0.1"
}
eslint {
config = ".eslintrc.json"
inputs = ["js/.js"]
}

A problem occurred starting process 'command 'eslint''

I can not run the plugin . Errors occur frequently when you start gradle eslint
A problem occurred starting process 'command 'eslint''
Here are the contents of build.gradle:
plugins {
id "com.github.scobal.eslint" version "1.0.4"
}
eslint {
inputs = ["**/.js"]
}

Feature Request: environment variable for project.exec

Would it be possible to supply the environment property to the project.exec task?
This is needed to that can specify the environment variables like PATH to specify the installation of node?
Otherwise it just looks for the global installed node option.

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.