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
Original file line number Diff line number Diff line change
@@ -1,66 +1,86 @@
{
"parser": "babel-eslint",
"plugins": [
"react", "babel", "flowtype"
],
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": false,
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"babel", "compat", "flowtype", "react", "import"
],
"import/resolver": {
"babel-module": {}
},
"import/core-modules": ["meteor/"],
"extends": ["eslint:recommended", "plugin:react/recommended"],
"env": {
"commonjs": true,
"es6": true,
"node": true
"node": true,
"mongo": true
},
"globals": {
"window": true,
"document": true
},
"rules": {
"no-extra-semi": "error",
"semi": ["error", "never"],
"flowtype/boolean-style": [
2,
"boolean"
],
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"class-methods-use-this": 0,
"comma-dangle": [2, "never"],
"compat/compat": 2,
"curly": [2, "all"],
"flowtype/boolean-style": [2, "boolean"],
"flowtype/define-flow-type": 1,
"flowtype/generic-spacing": [
2,
"never"
],
"flowtype/generic-spacing": [2, "never"],
"flowtype/require-parameter-type": 2,
"flowtype/require-return-type": [
2,
"always",
{
"annotateUndefined": "never"
}
],
"flowtype/require-return-type": [2, "always", { "annotateUndefined": "never" }],
"flowtype/require-valid-file-annotation": 2,
"flowtype/semi": [
2,
"never"
],
"flowtype/space-after-type-colon": [
2,
"always"
],
"flowtype/space-before-generic-bracket": [
2,
"never"
],
"flowtype/space-before-type-colon": [
2,
"never"
],
"flowtype/union-intersection-spacing": [
2,
"always"
],
"flowtype/semi": [2, "never"],
"flowtype/space-after-type-colon": [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/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": {
"flowtype": {
"onlyFilesWithFlowAnnotation": false
}
}
}
}
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"url": "https://github.com:Falieson/planetx-boilerplate-crater/issues"
},
"keywords": [
"meteor",
"babel",
"webpack",
"react",
"crater"
"webpack2",
"meteor",
"planetx",
"crater",
"babel"
],
"main": "index.js",
"nyc": {
Expand Down Expand Up @@ -115,8 +116,13 @@
"empty": "^0.10.1",
"es6-promise": "^4.1.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-compat": "^1.0.2",
"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-watch": "^3.1.0",
"extract-text-webpack-plugin": "^2.1.0",
Expand Down
12 changes: 6 additions & 6 deletions scripts/build-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import buildDir from '../buildDir'
const root = path.resolve(__dirname, '..')
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) ||
await isNewerThan(path.join(root, 'src'), assets)) {
console.log('building client bundle...')
const compiler = webpack(webpackConfig)
const stats = await promisify(compiler.run, compiler)()
process.stdout.write(stats.toString({
colors: true,
modules: false,
colors : true,
modules : false,
chunkModules: false,
chunks: true,
errorDetails: true,
chunks : true,
errorDetails: true
}) + "\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 {
console.log('client assets are up to date')
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const root = path.resolve(__dirname, '..')
process.on('SIGINT', (): any => process.exit(1))

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

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

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

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

async function buildServer(): Promise<void> {
async function buildServer (): Promise<void> {
await promisify(mkdirp)(buildDir)
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) ||
Expand All @@ -25,13 +25,13 @@ async function buildServer(): Promise<void> {
const compiler = webpack(webpackConfig)
const stats = await promisify(compiler.run, compiler)()
process.stdout.write(stats.toString({
colors: true,
modules: false,
colors : true,
modules : false,
chunkModules: false,
chunks: true,
errorDetails: true,
chunks : true,
errorDetails: true
}) + "\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 {
console.log('server assets are up to date')
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import buildMeteor from './build-meteor'
import buildServer from './build-server'
import buildClient from './build-client'

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

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

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

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
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 (PORT == null) {throw new Error("Missing process.env.PORT")}
if (ROOT_URL) {process.env.ROOT_URL = ROOT_URL.replace(`:${PORT}`, `:${webpackConfig.devServer.port}`)}

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}`)

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

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')))) {
console.log('installing Meteor npm dependencies...')
await spawnAsync('npm', ['install'], {
cwd: programsServer,
cwd : programsServer,
stdio: 'inherit'
})
} else {
Expand Down
2 changes: 1 addition & 1 deletion scripts/prod-debug-brk.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import path from 'path'
process.on('SIGINT', (): any => process.exit(1))

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

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

0 comments on commit 3c5a726

Please sign in to comment.