This is a Gradle plugin for running ESLint as part of your Gradle build.
-
Install ESLint via npm:
npm install eslint
-
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.1" } } apply plugin: "com.github.scobal.eslint"
-
Configure ESLint to include your Javascript files in your build.gradle
eslint { inputs = ["**/*.js*"] }
-
Run
gradle eslint
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, eg: "/usr/bin/eslint" |
inputs |
A list of files, directories and/or globs, 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 |
gradle-eslint-plugin is licensed under version 2.0 of the Apache License. See the LICENSE file for details.