Skip to content

Commit

Permalink
Use eslint-plugin-prettier instead of old messy airbnb based config
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Mar 16, 2017
1 parent c005d79 commit 4124c5a
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 220 deletions.
69 changes: 19 additions & 50 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,60 +1,29 @@
{
"parser": "babel-eslint",
"extends": [
"eslint-config-airbnb",
"google",
"plugin:flowtype/recommended",
"plugin:react/recommended",
"prettier",
"prettier/flowtype",
"prettier/react"
],
"plugins": [
"flowtype",
"flow-vars"
"react",
"prettier"
],
"rules": {
"indent": [2, 2, {"SwitchCase": 1}],
"no-console": [0],
"func-names": [0],
"semi": [2, "never"],
"no-extra-semi": [2],
"space-before-function-paren": [2, "always"],
"no-else-return": [0],
"space-infix-ops": [0],
"react/prefer-es6-class": [0],
"react/prefer-stateless-function": [0],
"no-underscore-dangle": ["error", { "allow": ["_config"] }],
"import/no-unresolved": [0],
"global-require": [0],
"no-duplicate-imports": [0],
"spaced-comment": [0],
"arrow-parens": [0],
/*"quotes": ["error", "backtick"],*/
/*"flowtype/require-parameter-type": 1,*/
/*"flowtype/require-return-type": [*/
/*1,*/
/*"always",*/
/*{*/
/*"annotateUndefined": "never"*/
/*}*/
/*],*/
/*"flowtype/space-after-type-colon": [*/
/*1,*/
/*"always"*/
/*],*/
/*"flowtype/space-before-type-colon": [*/
/*1,*/
/*"never"*/
/*],*/
/*"flowtype/type-id-match": [*/
/*0,*/
/*"^([A-Z][a-z0-9]+)+Type$"*/
/*],*/
/*"flow-vars/define-flow-type": 1,*/
/*"flow-vars/use-flow-type": 1,*/
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"globals": {
"__PREFIX_LINKS__": true,
"__LINK_PREFIX__": true,
"env": {
"es6": true,
"node": true
},
"settings": {
"flowtype": {
"onlyFilesWithFlowAnnotation": true
}
"rules": {
"prettier/prettier": ["error", {"trailingComma": true}]
}
}
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
{
"dependencies": {
"babel-cli": "^6.23.0",
"babel-cli": "^6.24.0",
"babel-eslint": "^7.1.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-async-to-generator": "^6.22.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.2.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-env": "^1.2.2",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.23.0",
"babel-preset-stage-0": "^6.22.0",
"babel-register": "^6.23.0",
"eslint": "^3.17.0",
"babel-register": "^6.24.0",
"babel-runtime": "^6.23.0",
"eslint": "^3.17.1",
"eslint-config-airbnb": "^14.1.0",
"eslint-config-google": "^0.7.1",
"eslint-config-prettier": "^1.5.0",
"eslint-plugin-flow-vars": "^0.5.0",
"eslint-plugin-flowtype": "^2.30.0",
"eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-prettier": "^2.0.1",
"eslint-plugin-react": "^6.10.0",
"flow-bin": "^0.41.0",
"iflow-debug": "^1.0.15",
Expand All @@ -28,9 +32,6 @@
"prettier": "^0.22.0",
"purdy": "^2.2.1"
},
"devDependencies": {
"babel-runtime": "^6.23.0"
},
"jest": {
"verbose": true,
"modulePathIgnorePatterns": [
Expand All @@ -51,7 +52,7 @@
"build": "lerna run build",
"lint": "eslint --ext .js,.jsx --ignore-path .gitignore .",
"lint:flow": "babel-node scripts/flow-check.js",
"fix-semi": "eslint --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix packages/**/src/*.js packages/gatsby/lib/**/*.js www/*.js www/**/*.js examples/gatsbygram/*.js examples/gatsbygram/**/*.js",
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix packages/**/src/*.js packages/gatsby/lib/**/*.js www/*.js www/**/*.js examples/gatsbygram/*.js examples/gatsbygram/**/*.js",
"format-packages": "prettier --trailing-comma es5 --write packages/**/src/*.js",
"format-gatsby": "prettier --trailing-comma es5 --write packages/gatsby/lib/**/*.js",
"format-www": "find www -iname *.js | grep -v node_modules | grep -v public | grep -v .intermediate-representation | xargs prettier --write --trailing-comma es5",
Expand Down
1 change: 0 additions & 1 deletion packages/gatsby-source-filesystem/src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Promise from "bluebird"
import mapLimit from "async/mapLimit"

const _ = require("lodash")
const path = require("path")
const md5File = require("md5-file")
const recursive = require("recursive-readdir")
Expand Down
8 changes: 3 additions & 5 deletions packages/gatsby/lib/utils/babel-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ function findBabelPackage(directory) {
module.exports = async function babelConfig(program, stage) {
const { directory } = program

let babelrc = findBabelrc(directory) ||
findBabelPackage(directory)
let babelrc = findBabelrc(directory) || findBabelPackage(directory)

// If user doesn't have a custom babelrc, add defaults.
if (!babelrc) {
Expand All @@ -137,10 +136,10 @@ module.exports = async function babelConfig(program, stage) {
}

// Add default plugins and presets.
[`es2015`, `stage-0`, `react`].forEach((preset) => {
[`es2015`, `stage-0`, `react`].forEach(preset => {
babelrc.presets.push(preset)
});
[`add-module-exports`, `transform-object-assign`].forEach((plugin) => {
[`add-module-exports`, `transform-object-assign`].forEach(plugin => {
babelrc.plugins.push(plugin)
})

Expand All @@ -167,7 +166,6 @@ module.exports = async function babelConfig(program, stage) {
modifiedConfig = {}
}


// Merge all together.
const merged = _.defaultsDeep(modifiedConfig, normalizedConfig)
return merged
Expand Down
Loading

0 comments on commit 4124c5a

Please sign in to comment.