Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
yjwong committed Sep 18, 2018
0 parents commit 155c36a
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{js,json}]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Node.js modules
node_modules/
104 changes: 104 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
module.exports = {
extends: [
'eslint:recommended',
],
parser: 'babel-eslint',
rules: {
'strict': [2, 'never'],

// Best Practices
'block-scoped-var': 'error',
'callback-return': 'warn',
'comma-dangle': ['error', 'always-multiline'],
'curly': 'error',
'dot-location': ['error', 'property'],
'dot-notation': ['error', { allowPattern: '^[a-z]+(_[a-z]+)+$' }],
'eqeqeq': 'error',
'no-alert': 'error',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-class-assign': 0,
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-debugger': 'warn',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-implicit-coercion': 'warn',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'babel/no-invalid-this': 'error', // Until supported by eslint itself
'no-loop-func': 'warn',
'no-multi-spaces': ['warn', { exceptions: { ImportDeclaration: true } }],
'no-multi-str': 'error',
'no-native-reassign': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-proto': 'error',
'no-script-url': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-unused-vars': 1,
'no-useless-call': 'error',
'no-useless-escape': 'error',

// Stylistic Issues
'block-spacing': 'warn',
'brace-style': ['warn', '1tbs', { allowSingleLine: true }],
'camelcase': 'warn',
'comma-spacing': 'warn',
'comma-style': 'warn',
'computed-property-spacing': 'warn',
'eol-last': 'warn',
'indent': ['error', 2, {
'SwitchCase': 1,
'ignoredNodes': ['JSXElement', 'JSXAttribute', 'JSXSpreadAttribute']
}],
'jsx-quotes': ['error', 'prefer-double'],
'key-spacing': 'error',
'keyword-spacing': 'error',
'linebreak-style': 'error',
'lines-around-comment': ['warn', { allowBlockStart: true }],
'max-depth': ['warn', 4],
'max-len': ['warn', 120],
'max-nested-callbacks': ['error', 3],
'max-statements': ['warn', 200],
'no-lonely-if': 'warn',
'no-multiple-empty-lines': 'warn',
'no-spaced-func': 'warn',
'no-trailing-spaces': 'warn',
'no-unneeded-ternary': 'warn',
'no-whitespace-before-property': 'error',
'babel/object-curly-spacing': ['warn', 'always'],
'one-var-declaration-per-line': 'warn',
'quotes': [2, 'single'],
'semi': ['error', 'always'],
'semi-spacing': 'warn',
'space-before-blocks': 'error',
'space-before-function-paren': ['warn', {
anonymous: 'always',
named: 'never'
}],
'space-in-parens': 'warn',
'space-infix-ops': 'warn',
'spaced-comment': 'warn',

// ECMAScript 6
'arrow-body-style': 'warn',
'arrow-spacing': 'warn',
'arrow-parens': ['warn', 'as-needed'],
'no-duplicate-imports': 'error',
'no-var': 'error',
'prefer-arrow-callback': 'warn',
'prefer-const': 'warn',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'warn',
'template-curly-spacing': 'warn',
},
plugins: [
'babel',
],
};
21 changes: 21 additions & 0 deletions jsx-control-statements.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
env: {
'jsx-control-statements/jsx-control-statements': true,
},
rules: {
'jsx-control-statements/jsx-choose-not-empty': 1,
'jsx-control-statements/jsx-for-require-each': 1,
'jsx-control-statements/jsx-for-require-of': 1,
'jsx-control-statements/jsx-if-require-condition': 1,
'jsx-control-statements/jsx-otherwise-once-last': 1,
'jsx-control-statements/jsx-use-if-tag': 1,
'jsx-control-statements/jsx-when-require-condition': 1,
'jsx-control-statements/jsx-jcs-no-undef': 0
},
extends: [
'plugin:jsx-control-statements/recommended',
],
plugins: [
'jsx-control-statements',
],
};
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@glints/eslint-config",
"version": "1.0.0",
"description": "ESLint rules for Glints projects.",
"keywords": [
"eslint",
"eslintconfig"
],
"main": "index.js",
"repository": "https://github.com/glints-dev/eslint-config",
"author": "Wong Yong Jie <[email protected]>",
"license": "MIT",
"private": false,
"peerDependencies": {
"eslint": ">= 5"
}
}
38 changes: 38 additions & 0 deletions react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
rules: {
// React
'react/display-name': 'warn',
'react/no-deprecated': 'warn',
'react/no-did-mount-set-state': 'error',
'react/no-did-update-set-state': 'error',
'react/no-direct-mutation-state': 'error',
'react/no-is-mounted': 'error',
'react/no-set-state': 'error',
'react/no-string-refs': 'error',
'react/no-unknown-property': 'warn',
'react/prefer-es6-class': 'warn',
'react/prefer-stateless-function': 'warn',
'react/prop-types': 'warn',
'react/react-in-jsx-scope': 2,
'react/require-render-return': 'error',
'react/self-closing-comp': 'warn',

// React/JSX
'react/jsx-boolean-value': ['warn', 'always'],
'react/jsx-equals-spacing': 'error',
'react/jsx-indent': ['warn', 2],
'react/jsx-key': 'warn',
'react/jsx-no-duplicate-props': 'error',
'react/jsx-no-undef': ['error', { allowGlobals: true }],
'react/jsx-pascal-case': 'warn',
'react/jsx-tag-spacing': ['warn', {
beforeSelfClosing: 'always',
}],
'react/jsx-uses-react': 2,
'react/jsx-uses-vars': 2,
'react/jsx-wrap-multilines': 'warn',
},
plugins: [
'react',
],
};
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


eslint-plugin-babel@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-5.2.0.tgz#3041a0c26aa3ca4a0e0f2aa11591f0396790d981"
dependencies:
eslint-rule-composer "^0.3.0"

eslint-rule-composer@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9"

0 comments on commit 155c36a

Please sign in to comment.