Eli Perelman
8 years ago
19 changed files with 1570 additions and 2877 deletions
@ -0,0 +1,26 @@ |
|||
{ |
|||
"name": "neutrino-preset-airbnb-base", |
|||
"version": "4.0.0", |
|||
"description": "Neutrino preset for adding Airbnb's base JS ESLint config, following the Airbnb styleguide", |
|||
"main": "src/index.js", |
|||
"keywords": [ |
|||
"neutrino", |
|||
"neutrino-preset", |
|||
"airbnb", |
|||
"eslint" |
|||
], |
|||
"author": "Eli Perelman <eli@eliperelman.com>", |
|||
"license": "MPL-2.0", |
|||
"repository": "mozilla-neutrino/neutrino-dev", |
|||
"dependencies": { |
|||
"babel-eslint": "^7.1.1", |
|||
"eslint": "^3.14.1", |
|||
"eslint-config-airbnb-base": "^11.1.0", |
|||
"eslint-loader": "^1.6.1", |
|||
"eslint-plugin-babel": "^4.0.1", |
|||
"eslint-plugin-import": "^2.2.0" |
|||
}, |
|||
"peerDependencies": { |
|||
"neutrino": "^4.0.0" |
|||
} |
|||
} |
@ -0,0 +1,58 @@ |
|||
'use strict'; |
|||
|
|||
const path = require('path'); |
|||
|
|||
const MODULES = path.join(__dirname, '../node_modules'); |
|||
|
|||
module.exports = ({ config }) => { |
|||
config |
|||
.module |
|||
.rule('lint') |
|||
.test(/\.(js|jsx)$/) |
|||
.pre() |
|||
.include(path.join(process.cwd(), 'src')) |
|||
.loader('eslint', require.resolve('eslint-loader'), { |
|||
failOnError: process.env.NODE_ENV !== 'development', |
|||
emitWarning: process.env.NODE_ENV !== 'development', |
|||
emitError: process.env.NODE_ENV !== 'development' |
|||
cwd: process.cwd(), |
|||
useEslintrc: false, |
|||
root: true, |
|||
plugins: ['babel'], |
|||
baseConfig: { |
|||
extends: ['airbnb-base'] |
|||
}, |
|||
envs: ['es6'], |
|||
parser: 'babel-eslint', |
|||
parserOptions: { |
|||
ecmaVersion: 2017, |
|||
sourceType: 'module', |
|||
ecmaFeatures: { |
|||
objectLiteralDuplicateProperties: false, |
|||
generators: true, |
|||
impliedStrict: true |
|||
} |
|||
}, |
|||
settings: {}, |
|||
globals: ['process'], |
|||
rules: { |
|||
// handled by babel rules
|
|||
'new-cap': 'off', |
|||
|
|||
// handled by babel rules
|
|||
'object-curly-spacing': 'off', |
|||
|
|||
// require a capital letter for constructors
|
|||
'babel/new-cap': ['error', { newIsCap: true }], |
|||
|
|||
// require padding inside curly braces
|
|||
'babel/object-curly-spacing': ['error', 'always'], |
|||
|
|||
// guard against awaiting async functions inside of a loop
|
|||
'babel/no-await-in-loop': 'error' |
|||
} |
|||
}); |
|||
|
|||
config.resolve.modules.add(MODULES); |
|||
config.resolveLoader.modules.add(MODULES); |
|||
}; |
File diff suppressed because it is too large
@ -1,19 +0,0 @@ |
|||
# Neutrino Base Preset [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] |
|||
|
|||
This [neutrino](https://github.com/mozilla-neutrino/neutrino) preset is abstract and should not be |
|||
used directly to build a JavaScript project. Rather, this preset contains shared configuration that |
|||
is extended by all other core neutrino presets. |
|||
|
|||
Modify this preset if there is shared configuration that should be propagated to all other core |
|||
neutrino presets. This preset contains the bulk of the shared Webpack and ESLint configuration. |
|||
|
|||
|
|||
# Technology |
|||
|
|||
* [neutrino-preset-base](https://github.com/mozilla-neutrino/neutrino-preset-base) |
|||
* babel-preset-es2015: Polyfill ES2015 syntaxes |
|||
|
|||
[npm-image]: https://badge.fury.io/js/neutrino-preset-base.svg |
|||
[npm-url]: https://npmjs.org/package/neutrino-preset-base |
|||
[daviddm-image]: https://david-dm.org/mozilla-neutrino/neutrino-preset-base.svg |
|||
[daviddm-url]: https://david-dm.org/mozilla-neutrino/neutrino-preset-base |
@ -1,33 +0,0 @@ |
|||
{ |
|||
"name": "neutrino-preset-base", |
|||
"version": "4.0.0", |
|||
"description": "Neutrino base preset for shared core configuration", |
|||
"main": "src/index.js", |
|||
"keywords": [ |
|||
"neutrino", |
|||
"neutrino-preset" |
|||
], |
|||
"author": "Eli Perelman <eli@eliperelman.com>", |
|||
"license": "MPL-2.0", |
|||
"repository": "mozilla-neutrino/neutrino-dev", |
|||
"dependencies": { |
|||
"babel-eslint": "^7.1.1", |
|||
"clean-webpack-plugin": "^0.1.15", |
|||
"copy-webpack-plugin": "4.0.1", |
|||
"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.7.0", |
|||
"progress-bar-webpack-plugin": "^1.9.3", |
|||
"webpack": "^2.2.1" |
|||
}, |
|||
"peerDependencies": { |
|||
"neutrino": "^4.0.0" |
|||
}, |
|||
"devDependencies": { |
|||
"eslint-plugin-react": "^6.9.0" |
|||
} |
|||
} |
@ -1,71 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
const CleanPlugin = require('clean-webpack-plugin'); |
|||
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'); |
|||
const PROJECT_MODULES = path.join(CWD, 'node_modules'); |
|||
const BASE_MODULES = path.join(__dirname, '../node_modules'); |
|||
const SRC = path.join(CWD, 'src'); |
|||
|
|||
module.exports = ({ config }) => { |
|||
config |
|||
.context(CWD) |
|||
.entry('index') |
|||
.add(path.join(SRC, 'index.js')) |
|||
.end() |
|||
.output |
|||
.path(path.join(process.cwd(), 'build')) |
|||
.filename('[name].bundle.js') |
|||
.chunkFilename('[id].[chunkhash].js') |
|||
.end() |
|||
.resolve |
|||
.modules |
|||
.add(PROJECT_MODULES) |
|||
.add(BASE_MODULES) |
|||
.end() |
|||
.extensions |
|||
.add('.js') |
|||
.add('json') |
|||
.end() |
|||
.end() |
|||
.resolveLoader |
|||
.modules |
|||
.add(PROJECT_MODULES) |
|||
.add(BASE_MODULES); |
|||
|
|||
config |
|||
.module |
|||
.rule('lint') |
|||
.test(/\.js$/) |
|||
.pre() |
|||
.include(SRC) |
|||
.loader('eslint', require.resolve('eslint-loader'), Object.assign({ |
|||
failOnError: process.env.NODE_ENV !== 'development', |
|||
emitWarning: process.env.NODE_ENV !== 'development', |
|||
emitError: process.env.NODE_ENV !== 'development' |
|||
}, lint)); |
|||
|
|||
if (process.env.NODE_ENV === 'development') { |
|||
config.devtool('eval'); |
|||
} else { |
|||
config.output.filename('[name].[chunkhash].bundle.js'); |
|||
|
|||
config |
|||
.plugin('copy') |
|||
.use(CopyPlugin, [{ context: SRC, from: `**/*` }], { ignore: ['*.js*'] }); |
|||
|
|||
config |
|||
.plugin('progress') |
|||
.use(ProgressBarPlugin); |
|||
|
|||
config |
|||
.plugin('clean') |
|||
.use(CleanPlugin, [BUILD], { root: CWD }); |
|||
} |
|||
}; |
File diff suppressed because it is too large
Loading…
Reference in new issue