Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Changes to linting and adding package config
Browse files Browse the repository at this point in the history
  • Loading branch information
eliperelman committed Feb 3, 2017
1 parent 47b3972 commit c26086d
Show file tree
Hide file tree
Showing 19 changed files with 803 additions and 933 deletions.
30 changes: 15 additions & 15 deletions packages/neutrino-preset-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
"license": "MPL-2.0",
"repository": "mozilla-neutrino/neutrino-dev",
"dependencies": {
"babel-core": "6.17.0",
"babel-eslint": "7.0.0",
"babel-loader": "6.2.5",
"babel-preset-es2015": "6.16.0",
"clean-webpack-plugin": "0.1.13",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-preset-env": "^1.1.8",
"clean-webpack-plugin": "^0.1.15",
"copy-webpack-plugin": "4.0.1",
"deepmerge": "1.2.0",
"eslint": "3.8.1",
"eslint-loader": "1.6.0",
"eslint-plugin-babel": "3.3.0",
"eslint-plugin-import": "2.0.1",
"eslint-plugin-mocha": "4.7.0",
"deepmerge": "^1.3.2",
"eslint": "^3.14.1",
"eslint-loader": "^1.6.1",
"eslint-plugin-babel": "^4.0.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-mocha": "^4.8.0",
"exports-loader": "0.6.3",
"imports-loader": "0.6.5",
"progress-bar-webpack-plugin": "1.9.0",
"webpack": "2.2.0",
"webpack-merge": "2.4.0"
"imports-loader": "^0.7.0",
"progress-bar-webpack-plugin": "^1.9.3",
"webpack": "^2.2.1",
"webpack-merge": "^2.6.1"
},
"peerDependencies": {
"neutrino": "^4.0.0"
Expand Down
45 changes: 14 additions & 31 deletions packages/neutrino-preset-base/src/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const eslint = {
useEslintrc: false,
root: true,
plugins: ['babel', 'mocha'],
extends: ['eslint:recommended'],
extends: [
'eslint:recommended',
],
env: {
es6: true
},
Expand All @@ -18,9 +20,7 @@ const eslint = {
}
},
settings: {},
globals: {
process: true
},
globals: ['process'],
rules: {
// enforces getter/setter pairs in objects
'accessor-pairs': 'off',
Expand Down Expand Up @@ -386,8 +386,9 @@ const eslint = {
requireReturnForObjectLiteral: false,
}],

// handled by babel rules
'arrow-parens': 'off',
// require parens in arrow function arguments
// http://eslint.org/docs/rules/arrow-parens
'arrow-parens': ['error', 'as-needed'],

// require space before/after arrow function's arrow
// http://eslint.org/docs/rules/arrow-spacing
Expand All @@ -398,7 +399,7 @@ const eslint = {

// enforce the spacing around the * in generator functions
// http://eslint.org/docs/rules/generator-star-spacing
'generator-star-spacing': 'off',
'generator-star-spacing': ['error', { before: false, after: true }],

// disallow modifying variables of class declarations
// http://eslint.org/docs/rules/no-class-assign
Expand Down Expand Up @@ -452,8 +453,9 @@ const eslint = {
// require let or const instead of var
'no-var': 'error',

// handled by babel rules
'object-shorthand': 'off',
// require method and property shorthand syntax for object literals
// http://eslint.org/docs/rules/object-shorthand
'object-shorthand': ['error', 'always'],

// suggest using arrow functions as callbacks
'prefer-arrow-callback': ['error', {
Expand Down Expand Up @@ -520,8 +522,8 @@ const eslint = {
// babel inserts `'use strict';` for us
strict: ['error', 'never'],

// handled by babel rules
'array-bracket-spacing': 'off',
// enforce spacing inside array brackets
'array-bracket-spacing': ['error', 'never'],

// enforce spacing inside single-line blocks
// http://eslint.org/docs/rules/block-spacing
Expand Down Expand Up @@ -884,33 +886,14 @@ const eslint = {
// disallow use of variables before they are defined
'no-use-before-define': 'error',

// enforce the spacing around the * in generator functions
// http://eslint.org/docs/rules/generator-star-spacing
'babel/generator-star-spacing': ['error', { before: false, after: true }],

// require a capital letter for constructors
'babel/new-cap': ['error', { newIsCap: true }],

// enforce spacing inside array brackets
'babel/array-bracket-spacing': ['error', 'never'],

// require padding inside curly braces
'babel/object-curly-spacing': ['error', 'always'],

// require method and property shorthand syntax for object literals
// http://eslint.org/docs/rules/object-shorthand
'babel/object-shorthand': ['error', 'always'],

// require parens in arrow function arguments
// http://eslint.org/docs/rules/arrow-parens
'babel/arrow-parens': ['error', 'as-needed'],

// guard against awaiting async functions inside of a loop
'babel/no-await-in-loop': 'error',

// forbid trailing commas for function parameter lists. Behaves like, and takes the same options
// as comma-dangle
'babel/func-params-comma-dangle': 'error'
'babel/no-await-in-loop': 'error'
}
};

Expand Down
13 changes: 10 additions & 3 deletions packages/neutrino-preset-base/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const webpack = require('webpack');
const lint = require('./eslint');

const CWD = process.cwd();
const BUILD = path.join(CWD, 'build');
Expand Down Expand Up @@ -37,7 +38,10 @@ const config = {
test: /\.js$/,
include: [SRC],
enforce: 'pre',
use: require.resolve('eslint-loader')
use: {
loader: require.resolve('eslint-loader'),
options: lint
}
},
{
test: /\.js$/,
Expand All @@ -46,7 +50,7 @@ const config = {
loader: require.resolve('babel-loader'),
options: {
presets: [
[require.resolve('babel-preset-es2015'), { modules: false }]
[require.resolve('babel-preset-env'), { modules: false, targets: {} }]
],
plugins: [],
env: {
Expand All @@ -64,7 +68,10 @@ const config = {
}
};

const eslint = { configFile: path.join(__dirname, 'eslint.js'), emitError: true, failOnError: true };
const eslint = {
emitError: true,
failOnError: true
};

if (process.env.NODE_ENV === 'development') {
config.devtool = 'eval';
Expand Down
Loading

0 comments on commit c26086d

Please sign in to comment.