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 0.3.0 to 0.4.0

8

CHANGELOG.md

@@ -1,3 +0,9 @@

# 0.3.0 - 2015-012-10
# 0.4.0 - 2015-02-23
- Changed: upgrate to eslint 0.15.x
- Changed: more readable default reporter
- Added: `reporter` options allow to define a custom reporter function
# 0.3.0 - 2015-02-10
- Changed: upgrade to eslint 0.14.x

@@ -4,0 +10,0 @@

38

index.js

@@ -5,4 +5,5 @@ "use strict";

var Config = require("eslint/lib/config");
// var loaderUtils = require("loader-utils")
//
var stylish = require("eslint/lib/formatters/stylish")
/**

@@ -16,23 +17,24 @@ * linter

function lint(input, config, webpack) {
var messages = []
var res = eslint.verify(input, config)
if (res.length) {
var reporter = webpack.options.eslint.reporter || function(results) {
// in order to use eslint formatters
// we need to reproduce the object passed to them
var msgs = stylish([{
filePath: "",
messages: results
}]).split("\n")
// drop the line that should contains filepath we do not have
msgs.splice(0, 1)
eslint.verify(input, config).forEach(function eslintMessageCallback(m) {
messages.push(
" " + m.message +
"(" + m.ruleId + ")" +
" @ line " + m.line + " column " + m.column +
" - " +
(m.fatal ? "fatal, " : "") +
"severity: " + m.severity
)
})
return msgs.join("\n")
}
var messages = reporter(res)
var emitter = webpack.options.eslint.emitErrors ? webpack.emitError : webpack.emitWarning
if (messages.length) {
var message = messages.join("\n\n")
var emitter = webpack.options.eslint.emitErrors ? webpack.emitError : webpack.emitWarning
if (emitter) {
emitter("eslint results in errors\n" + message)
emitter(messages)
}
else {
throw new Error("Your module system doesn't support emitWarning. Update available? \n" + message)
throw new Error("Your module system doesn't support emitWarning. Update available? \n" + messages)
}

@@ -39,0 +41,0 @@ }

{
"name": "eslint-loader",
"version": "0.3.0",
"version": "0.4.0",
"description": "eslint loader (for webpack)",

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

"peerDependencies": {
"eslint": "^0.14.1"
"eslint": "^0.15.0"
},

@@ -37,3 +37,3 @@ "dependencies": {

"devDependencies": {
"eslint": "^0.14.1",
"eslint": "^0.15.0",
"jscs": "^1.8.1",

@@ -40,0 +40,0 @@ "tape": "^3.0.3",

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

You can pass directly some [eslint options](http://eslint.org/docs/configuring/) by adding an `eslint` entry in you webpack config:
```js
module.exports = {
eslint: {
configFile: 'path/.eslintrc'
}
}
```
#### `reporter` (default: wrapper eslint stylish reporter)
Loader accepts a function that will have one argument: an array of eslint messages (object)
#### `emitErrors` (default: `false`)

@@ -31,0 +45,0 @@

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