Skip to content

Instantly share code, notes, and snippets.

@derekclair
Last active October 25, 2017 03:25
Show Gist options
  • Save derekclair/94f69487be2588e70a08def7fc4093db to your computer and use it in GitHub Desktop.
Save derekclair/94f69487be2588e70a08def7fc4093db to your computer and use it in GitHub Desktop.
Proposed: ESLint Config
const OFF = 0;
const WARN = 1;
const ERROR = 2;
module.exports = {
'env': {
'browser': true,
'es6': true,
'node': true,
'mocha': true,
'jquery': true
},
'parser': 'babel-eslint',
'parserOptions': {
'ecmaFeatures': {
'jsx': true
},
'sourceType': 'module'
},
'plugins': [
'flowtype',
'jsx-a11y',
'import',
'react',
],
'extends': [
'plugin:flowtype/recommended',
'airbnb',
],
'globals': {
'_': false,
'autoprefixer': false,
'io': false,
'path': false
},
'root': true,
'rules': {
'comma-dangle': [ERROR, { // `airbnb` defaults to ERROR
'arrays': 'always-multiline',
'objects': 'always-multiline',
'imports': 'always-multiline',
'exports': 'always-multiline',
'functions': 'ignore' // this prevents "ESLint Autofix" from ADDING comas. Once we upgrade Node to support trailing commas in parameters we can eliminate this.
}],
'react/sort-comp': [
WARN,
{
order: [
'static-methods',
'typing',
'lifecycle',
'events',
'rendering',
'everything-else'
],
groups: {
typing: [
'context',
'props',
'state',
'type-annotations',
],
events: [
'/^on.+$/',
'/^get.+$/',
'/^set.+$/',
],
rendering: [
"/^render.+$/",
"render"
]
}
}
],
},
'settings': {
'flowtype': {
onlyFilesWithFlowAnnotation: true
},
'import/resolver': {
webpack: [
'webpack.react.config.js',
'webpack.config.js',
]
},
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment