Skip to content

Commit

Permalink
PX CONFIG eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Falieson committed Apr 24, 2017
1 parent 1172001 commit 3c5a726
Show file tree
Hide file tree
Showing 34 changed files with 354 additions and 324 deletions.
106 changes: 63 additions & 43 deletions .eslintrc
@@ -1,66 +1,86 @@
{ {
"parser": "babel-eslint", "parser": "babel-eslint",
"plugins": [
"react", "babel", "flowtype"
],
"parserOptions": { "parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": false,
"ecmaFeatures": { "ecmaFeatures": {
"jsx": true "jsx": true
} }
}, },
"plugins": [
"babel", "compat", "flowtype", "react", "import"
],
"import/resolver": {
"babel-module": {}
},
"import/core-modules": ["meteor/"],
"extends": ["eslint:recommended", "plugin:react/recommended"], "extends": ["eslint:recommended", "plugin:react/recommended"],
"env": { "env": {
"commonjs": true, "commonjs": true,
"es6": true, "es6": true,
"node": true "node": true,
"mongo": true
},
"globals": {
"window": true,
"document": true
}, },
"rules": { "rules": {
"no-extra-semi": "error", "brace-style": [2, "1tbs", { "allowSingleLine": true }],
"semi": ["error", "never"], "class-methods-use-this": 0,
"flowtype/boolean-style": [ "comma-dangle": [2, "never"],
2, "compat/compat": 2,
"boolean" "curly": [2, "all"],
], "flowtype/boolean-style": [2, "boolean"],
"flowtype/define-flow-type": 1, "flowtype/define-flow-type": 1,
"flowtype/generic-spacing": [ "flowtype/generic-spacing": [2, "never"],
2,
"never"
],
"flowtype/require-parameter-type": 2, "flowtype/require-parameter-type": 2,
"flowtype/require-return-type": [ "flowtype/require-return-type": [2, "always", { "annotateUndefined": "never" }],
2,
"always",
{
"annotateUndefined": "never"
}
],
"flowtype/require-valid-file-annotation": 2, "flowtype/require-valid-file-annotation": 2,
"flowtype/semi": [ "flowtype/semi": [2, "never"],
2, "flowtype/space-after-type-colon": [2, "always"],
"never" "flowtype/space-before-generic-bracket": [2, "never"],
], "flowtype/space-before-type-colon": [2, "never"],
"flowtype/space-after-type-colon": [ "flowtype/union-intersection-spacing": [2, "always"],
2,
"always"
],
"flowtype/space-before-generic-bracket": [
2,
"never"
],
"flowtype/space-before-type-colon": [
2,
"never"
],
"flowtype/union-intersection-spacing": [
2,
"always"
],
"flowtype/use-flow-type": 1, "flowtype/use-flow-type": 1,
"flowtype/valid-syntax": 1 "flowtype/valid-syntax": 1,
"func-names": 0,
"import/extensions": [0, "always", { "js": "never", "jsx": "never" }],
"import/first": 0,
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": [0, { "ignore": ["^meteor/"] }],
"import/prefer-default-export": 1,
"indent": [2, 2, { "SwitchCase": 1 }],
"key-spacing": [2, { "align": "colon" }],
"keyword-spacing": 0,
"linebreak-style": 1,
"max-len": [1, 120],
"no-case-declarations": 0,
"no-cond-assign": 2,
"no-console": [1, { "allow": ["warn", "error"] }],
"no-extra-semi": "error",
"no-param-reassign": 2,
"no-underscore-dangle": 0,
"no-unused-expressions": [2, { "allowShortCircuit": true }],
"no-unused-vars": [2, { "args": "all", "varsIgnorePattern": "[mM]eteor" }],
"no-use-before-define": [2, { "functions": false, "classes": true }],
"padding-blocks": 0,
"prefer-arrow-callback": 1,
"prefer-destructuring": [2, { "array": false, "object": true }, { "enforceForRenamedProperties": false }],
"prefer-spread": 2,
"react/jsx-filename-extension": 0,
"react/no-danger": 1,
"react/no-find-dom-node": 1,
"react/no-string-refs": 2,
"react/no-unused-prop-types": 1,
"react/prop-types": 1,
"react/sort-comp": 1,
"semi": ["error", "never"],
"space-before-function-paren": 1
}, },
"settings": { "settings": {
"flowtype": { "flowtype": {
"onlyFilesWithFlowAnnotation": false "onlyFilesWithFlowAnnotation": false
} }
} }
} }
14 changes: 10 additions & 4 deletions package.json
Expand Up @@ -13,11 +13,12 @@
"url": "https://github.com:Falieson/planetx-boilerplate-crater/issues" "url": "https://github.com:Falieson/planetx-boilerplate-crater/issues"
}, },
"keywords": [ "keywords": [
"meteor",
"babel",
"webpack",
"react", "react",
"crater" "webpack2",
"meteor",
"planetx",
"crater",
"babel"
], ],
"main": "index.js", "main": "index.js",
"nyc": { "nyc": {
Expand Down Expand Up @@ -115,8 +116,13 @@
"empty": "^0.10.1", "empty": "^0.10.1",
"es6-promise": "^4.1.0", "es6-promise": "^4.1.0",
"eslint": "^3.19.0", "eslint": "^3.19.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-import-resolver-babel-module": "^3.0.0",
"eslint-plugin-babel": "^4.1.1", "eslint-plugin-babel": "^4.1.1",
"eslint-plugin-compat": "^1.0.2",
"eslint-plugin-flowtype": "^2.32.1", "eslint-plugin-flowtype": "^2.32.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.3", "eslint-plugin-react": "^6.10.3",
"eslint-watch": "^3.1.0", "eslint-watch": "^3.1.0",
"extract-text-webpack-plugin": "^2.1.0", "extract-text-webpack-plugin": "^2.1.0",
Expand Down
12 changes: 6 additions & 6 deletions scripts/build-client.js
Expand Up @@ -12,20 +12,20 @@ import buildDir from '../buildDir'
const root = path.resolve(__dirname, '..') const root = path.resolve(__dirname, '..')
const assets = path.join(buildDir, 'assets.json') const assets = path.join(buildDir, 'assets.json')


async function buildClient(): Promise<void> { async function buildClient (): Promise<void> {
if (await isNewerThan(path.join(root, 'webpack', 'webpack.config.prod.js'), assets) || if (await isNewerThan(path.join(root, 'webpack', 'webpack.config.prod.js'), assets) ||
await isNewerThan(path.join(root, 'src'), assets)) { await isNewerThan(path.join(root, 'src'), assets)) {
console.log('building client bundle...') console.log('building client bundle...')
const compiler = webpack(webpackConfig) const compiler = webpack(webpackConfig)
const stats = await promisify(compiler.run, compiler)() const stats = await promisify(compiler.run, compiler)()
process.stdout.write(stats.toString({ process.stdout.write(stats.toString({
colors: true, colors : true,
modules: false, modules : false,
chunkModules: false, chunkModules: false,
chunks: true, chunks : true,
errorDetails: true, errorDetails: true
}) + "\n") }) + "\n")
if (stats.toJson().errors.length) throw new Error("webpack build had errors") if (stats.toJson().errors.length) {throw new Error("webpack build had errors")}
} else { } else {
console.log('client assets are up to date') console.log('client assets are up to date')
} }
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-docker.js
Expand Up @@ -13,7 +13,7 @@ const root = path.resolve(__dirname, '..')
process.on('SIGINT', (): any => process.exit(1)) process.on('SIGINT', (): any => process.exit(1))


const opts = { const opts = {
cwd: root, cwd : root,
stdio: 'inherit' stdio: 'inherit'
} }


Expand Down
6 changes: 3 additions & 3 deletions scripts/build-meteor.js
Expand Up @@ -14,19 +14,19 @@ import buildDir from '../buildDir'
const root = path.resolve(__dirname, '..') const root = path.resolve(__dirname, '..')
const meteor = path.join(root, 'meteor') const meteor = path.join(root, 'meteor')


async function buildMeteor(): Promise<void> { async function buildMeteor (): Promise<void> {
await promisify(mkdirp)(buildDir) await promisify(mkdirp)(buildDir)
if (await isNewerThan([ if (await isNewerThan([
...await promisify(glob)(path.join(meteor, '**')), ...await promisify(glob)(path.join(meteor, '**')),
path.join(meteor, '.meteor', 'packages'), path.join(meteor, '.meteor', 'packages'),
path.join(meteor, '.meteor', 'platforms'), path.join(meteor, '.meteor', 'platforms'),
path.join(meteor, '.meteor', 'release'), path.join(meteor, '.meteor', 'release'),
path.join(meteor, '.meteor', 'versions'), path.join(meteor, '.meteor', 'versions')
], path.join(buildDir, 'meteor'))) { ], path.join(buildDir, 'meteor'))) {
console.log('building Meteor packages...') console.log('building Meteor packages...')
await promisify(rimraf)(path.join(buildDir, 'meteor')) await promisify(rimraf)(path.join(buildDir, 'meteor'))
await spawnAsync('meteor', ['build', path.join(path.relative(meteor, buildDir), 'meteor'), '--directory'], { await spawnAsync('meteor', ['build', path.join(path.relative(meteor, buildDir), 'meteor'), '--directory'], {
cwd: meteor, cwd : meteor,
stdio: 'inherit' stdio: 'inherit'
}) })
} else { } else {
Expand Down
12 changes: 6 additions & 6 deletions scripts/build-server.js
Expand Up @@ -16,7 +16,7 @@ const prerender = path.join(buildDir, 'prerender.js')


const opts = {cwd: root, stdio: 'inherit'} const opts = {cwd: root, stdio: 'inherit'}


async function buildServer(): Promise<void> { async function buildServer (): Promise<void> {
await promisify(mkdirp)(buildDir) await promisify(mkdirp)(buildDir)
await spawnAsync('babel', [path.join(root, 'src', 'index.js'), '-o', path.join(buildDir, 'index.js')], opts) await spawnAsync('babel', [path.join(root, 'src', 'index.js'), '-o', path.join(buildDir, 'index.js')], opts)
if (await isNewerThan(path.join(root, 'webpack', 'webpack.config.server.js'), prerender) || if (await isNewerThan(path.join(root, 'webpack', 'webpack.config.server.js'), prerender) ||
Expand All @@ -25,13 +25,13 @@ async function buildServer(): Promise<void> {
const compiler = webpack(webpackConfig) const compiler = webpack(webpackConfig)
const stats = await promisify(compiler.run, compiler)() const stats = await promisify(compiler.run, compiler)()
process.stdout.write(stats.toString({ process.stdout.write(stats.toString({
colors: true, colors : true,
modules: false, modules : false,
chunkModules: false, chunkModules: false,
chunks: true, chunks : true,
errorDetails: true, errorDetails: true
}) + "\n") }) + "\n")
if (stats.toJson().errors.length) throw new Error("webpack build had errors") if (stats.toJson().errors.length) {throw new Error("webpack build had errors")}
} else { } else {
console.log('server assets are up to date') console.log('server assets are up to date')
} }
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Expand Up @@ -6,7 +6,7 @@ import buildMeteor from './build-meteor'
import buildServer from './build-server' import buildServer from './build-server'
import buildClient from './build-client' import buildClient from './build-client'


async function build(): Promise<void> { async function build (): Promise<void> {
await buildMeteor() await buildMeteor()
await Promise.all([buildClient(), buildServer()]) await Promise.all([buildClient(), buildServer()])
} }
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug-brk.js
Expand Up @@ -8,6 +8,6 @@ import path from 'path'
process.on('SIGINT', (): any => process.exit(1)) process.on('SIGINT', (): any => process.exit(1))


start({ start({
commandOptions: ['--debug-brk'], commandOptions: ['--debug-brk']
}) })
spawn('node-inspector', [], {cwd: path.resolve(__dirname, '..'), stdio: 'inherit'}) spawn('node-inspector', [], {cwd: path.resolve(__dirname, '..'), stdio: 'inherit'})
2 changes: 1 addition & 1 deletion scripts/debug.js
Expand Up @@ -8,6 +8,6 @@ import path from 'path'
process.on('SIGINT', (): any => process.exit(1)) process.on('SIGINT', (): any => process.exit(1))


start({ start({
commandOptions: ['--debug'], commandOptions: ['--debug']
}) })
spawn('node-inspector', [], {cwd: path.resolve(__dirname, '..'), stdio: 'inherit'}) spawn('node-inspector', [], {cwd: path.resolve(__dirname, '..'), stdio: 'inherit'})
8 changes: 4 additions & 4 deletions scripts/devServer.js
Expand Up @@ -6,10 +6,10 @@ import createDebug from 'debug'


const shutdownDebug = createDebug('crater:shutdown') const shutdownDebug = createDebug('crater:shutdown')


if (process.env.USE_DOTENV) require('dotenv').config() if (process.env.USE_DOTENV) {require('dotenv').config()}
const {PORT, ROOT_URL} = process.env const {PORT, ROOT_URL} = process.env
if (PORT == null) throw new Error("Missing process.env.PORT") if (PORT == null) {throw new Error("Missing process.env.PORT")}
if (ROOT_URL) process.env.ROOT_URL = ROOT_URL.replace(`:${PORT}`, `:${webpackConfig.devServer.port}`) if (ROOT_URL) {process.env.ROOT_URL = ROOT_URL.replace(`:${PORT}`, `:${webpackConfig.devServer.port}`)}


const app = express() const app = express()


Expand All @@ -30,7 +30,7 @@ server.on('upgrade', (req: Object, socket: any, head: any): any => proxy.ws(req,


console.log(`Dev server is listening on http://0.0.0.0:${webpackConfig.devServer.port}`) console.log(`Dev server is listening on http://0.0.0.0:${webpackConfig.devServer.port}`)


function shutdown() { function shutdown () {
shutdownDebug('got signal, shutting down') shutdownDebug('got signal, shutting down')
server.close() server.close()
process.exit(0) process.exit(0)
Expand Down
6 changes: 3 additions & 3 deletions scripts/docker.js
Expand Up @@ -17,9 +17,9 @@ asyncScript(async (): Promise<any> => {
...process.env, ...process.env,
NAME, NAME,
ROOT_URL: 'http://localhost:3000', ROOT_URL: 'http://localhost:3000',
TAG: commitHash, TAG : commitHash
}, },
cwd: root, cwd : root,
stdio: 'inherit', stdio: 'inherit'
}) })
}) })
4 changes: 2 additions & 2 deletions scripts/installMeteorDeps.js
Expand Up @@ -8,11 +8,11 @@ import buildDir from '../buildDir'


const programsServer = path.join(buildDir, 'meteor', 'bundle', 'programs', 'server') const programsServer = path.join(buildDir, 'meteor', 'bundle', 'programs', 'server')


async function installMeteorDeps(): Promise<any> { async function installMeteorDeps (): Promise<any> {
if (!(await isDirectory(path.join(programsServer, 'node_modules')))) { if (!(await isDirectory(path.join(programsServer, 'node_modules')))) {
console.log('installing Meteor npm dependencies...') console.log('installing Meteor npm dependencies...')
await spawnAsync('npm', ['install'], { await spawnAsync('npm', ['install'], {
cwd: programsServer, cwd : programsServer,
stdio: 'inherit' stdio: 'inherit'
}) })
} else { } else {
Expand Down
2 changes: 1 addition & 1 deletion scripts/prod-debug-brk.js
Expand Up @@ -8,6 +8,6 @@ import path from 'path'
process.on('SIGINT', (): any => process.exit(1)) process.on('SIGINT', (): any => process.exit(1))


prod({ prod({
commandOptions: ['--debug'], commandOptions: ['--debug']
}) })
spawn('node-inspector', [], {cwd: path.resolve(__dirname, '..'), stdio: 'inherit'}) spawn('node-inspector', [], {cwd: path.resolve(__dirname, '..'), stdio: 'inherit'})
2 changes: 1 addition & 1 deletion scripts/prod-debug.js
Expand Up @@ -8,6 +8,6 @@ import path from 'path'
process.on('SIGINT', (): any => process.exit(1)) process.on('SIGINT', (): any => process.exit(1))


prod({ prod({
commandOptions: ['--debug'], commandOptions: ['--debug']
}) })
spawn('node-inspector', [], {cwd: path.resolve(__dirname, '..'), stdio: 'inherit'}) spawn('node-inspector', [], {cwd: path.resolve(__dirname, '..'), stdio: 'inherit'})

0 comments on commit 3c5a726

Please sign in to comment.