Socket
Socket
Sign inDemoInstall

eslint-loader

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-loader - npm Package Compare versions

Comparing version 1.6.1 to 1.6.2

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# 1.6.2 - 2017-02-22
- Fixed: fallback to OS temp directory if findCacheDir fails
([#154](https://github.com/MoOx/eslint-loader/pull/154) - @viankakrisna)
- Fixed: `loader-utils` deprecation warning by upgrading to v1.0.0
([#155](https://github.com/MoOx/eslint-loader/pull/155) - @fknussel)
# 1.6.1 - 2016-11-02

@@ -2,0 +9,0 @@

5

index.js

@@ -8,2 +8,3 @@ var eslint = require("eslint")

var objectHash = require("object-hash")
var os = require("os")

@@ -151,3 +152,3 @@ var engines = {}

// loader query string
loaderUtils.parseQuery(this.query)
loaderUtils.getOptions(this)
)

@@ -170,3 +171,3 @@ this.cacheable()

})
cachePath = thunk("data.json")
cachePath = thunk("data.json") || os.tmpdir() + "/data.json"
try {

@@ -173,0 +174,0 @@ cache = require(cachePath)

18

package.json
{
"name": "eslint-loader",
"version": "1.6.1",
"version": "1.6.2",
"description": "eslint loader (for webpack)",

@@ -23,3 +23,3 @@ "keywords": [

"find-cache-dir": "^0.1.1",
"loader-utils": "^0.2.7",
"loader-utils": "^1.0.2",
"object-assign": "^4.0.1",

@@ -29,14 +29,20 @@ "object-hash": "^1.1.4"

"devDependencies": {
"ava": "^0.17.0",
"eslint": "^3.0.0",
"eslint-friendly-formatter": "^2.0.4",
"npmpub": "^3.0.1",
"tape": "^4.0.0",
"webpack": "^1.8.4"
"webpack": "^2.2.0"
},
"scripts": {
"lint": "eslint .",
"tape": "tape test/*.js",
"test": "npm run lint && npm run tape",
"ava": "ava",
"test": "npm run lint && npm run ava",
"release": "npmpub"
},
"ava": {
"files": [
"test/*.js"
],
"verbose": true
}
}

@@ -19,6 +19,13 @@ # eslint-loader [![Build Status](http://img.shields.io/travis/MoOx/eslint-loader.svg)](https://travis-ci.org/MoOx/eslint-loader)

module: {
loaders: [
{test: /\.js$/, loader: "eslint-loader", exclude: /node_modules/}
]
}
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
// eslint options (if necessary)
}
},
],
},
// ...

@@ -35,6 +42,13 @@ }

module: {
loaders: [
{test: /\.js$/, loaders: [ "babel-loader", "eslint-loader" ], exclude: /node_modules/},
]
}
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
"babel-loader",
"eslint-loader",
],
},
],
},
// ...

@@ -44,3 +58,3 @@ }

To be safe, you can use `preLoaders` section to check source files, not modified
To be safe, you can use `enforce: "pre"` section to check source files, not modified
by other loaders (like `babel-loader`)

@@ -52,57 +66,28 @@

module: {
preLoaders: [
{test: /\.js$/, loader: "eslint-loader", exclude: /node_modules/}
]
}
// ...
}
```
[webpack@2.1.0-beta.23 has breaking changes](https://github.com/webpack/webpack/releases).
`preLoaders` is removed from the webpack^2.1.0-beta.23. so move it to `loaders` and using [enforce: "pre"] instead.
```js
module.exports = {
// ...
module: {
loaders: [
{enforce: "pre", test: /\.js$/, loader: "eslint-loader", exclude: /node_modules/}
// ... other loader
]
}
// ...
}
```
### Options
You can pass [eslint options](http://eslint.org/docs/developer-guide/nodejs-api#cliengine) directly by
- Adding a query string to the loader for this loader usage only
```js
{
module: {
preLoaders: [
rules: [
{
enforce: "pre",
test: /\.js$/,
loader: "eslint-loader?{rules:{semi:0}}",
exclude: /node_modules/,
loader: "eslint-loader",
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
},
// ...
}
```
- Adding an `eslint` entry in your webpack config for global options:
### Options
```js
module.exports = {
eslint: {
configFile: 'path/.eslintrc'
}
}
```
You can pass [eslint options](http://eslint.org/docs/developer-guide/nodejs-api#cliengine)
using standard webpack [loader options](https://webpack.js.org/configuration/module/#useentry).
**Note that you can use both methods in order to benefit from global & specific options**
Note that the config option you provide will be passed to the `CLIEngine`.
This is a different set of options than what you'd specify in `package.json` or `.eslintrc`.
See the [eslint docs](http://eslint.org/docs/developer-guide/nodejs-api#cliengine) for more detail.

@@ -114,3 +99,3 @@ #### `fix` (default: false)

**Be careful, this option might cause webpack to enter an infinite build loop if
**Be careful: this option might cause webpack to enter an infinite build loop if
some issues cannot be fixed properly.**

@@ -136,23 +121,29 @@

module: {
// ...
}
eslint: {
// several examples !
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
// several examples !
// default value
formatter: require("eslint/lib/formatters/stylish"),
// default value
formatter: require("eslint/lib/formatters/stylish"),
// community formatter
formatter: require("eslint-friendly-formatter"),
// community formatter
formatter: require("eslint-friendly-formatter"),
// custom formatter
formatter: function(results) {
// `results` format is available here
// http://eslint.org/docs/developer-guide/nodejs-api.html#executeonfiles()
// custom formatter
formatter: function(results) {
// `results` format is available here
// http://eslint.org/docs/developer-guide/nodejs-api.html#executeonfiles()
// you should return a string
// DO NOT USE console.*() directly !
return "OUTPUT"
}
}
// you should return a string
// DO NOT USE console.*() directly !
return "OUTPUT"
}
}
},
],
},
}

@@ -175,7 +166,13 @@ ```

module: {
// ...
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
emitError: true,
}
},
],
},
eslint: {
emitError: true
}
}

@@ -196,7 +193,13 @@ ```

module: {
// ...
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
quiet: true,
}
},
],
},
eslint: {
quiet: true
}
}

@@ -213,7 +216,13 @@ ```

module: {
// ...
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
failOnWarning: true,
}
},
],
},
eslint: {
failOnWarning: true
}
}

@@ -230,7 +239,13 @@ ```

module: {
// ...
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
failOnError: true,
}
},
],
},
eslint: {
failOnError: true
}
}

@@ -249,10 +264,16 @@ ```

module: {
// ...
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
outputReport: {
filePath: 'checkstyle.xml',
formatter: require('eslint/lib/formatters/checkstyle')
}
}
},
],
},
eslint: {
outputReport: {
filePath: 'checkstyle.xml',
formatter: require('eslint/lib/formatters/checkstyle')
}
}
}

@@ -272,4 +293,13 @@ ```

### Defining `configFile` or using `eslint -c path/.eslintrc`
Bear in mind that when you define `configFile`, `eslint` doesn't automatically look for
`.eslintrc` files in the directory of the file to be linted.
More information is available in official eslint documentation in section [_Using Configuration Files_](http://eslint.org/docs/user-guide/configuring#using-configuration-files).
See [#129](https://github.com/MoOx/eslint-loader/issues/129).
---
## [Changelog](CHANGELOG.md)
## [License](LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc