Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Less noise and more helpful rules #2

Merged
merged 5 commits into from Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
@@ -1,6 +1,6 @@
# eslint-config-kodefox
# ESLint Config for KodeFox

Various configuration commonly used by KodeFox for TypeScript projects.
ESLint configuration used for TypeScript projects.

## Install

Expand All @@ -10,20 +10,20 @@ $ yarn add --dev eslint-config-kodefox

## Usage

Add to `eslintConfig.extends` in `package.json`.
Modify `eslintConfig` in `package.json` as follows.

### Typescript
### TypeScript

```json
{
"name": "cool-express-server",
"name": "cool-node-server",
"eslintConfig": {
"extends": "kodefox"
}
}
```

### Typescript + React
### TypeScript + React

```json
{
Expand All @@ -34,7 +34,7 @@ Add to `eslintConfig.extends` in `package.json`.
}
```

### Typescript + React Native
### TypeScript + React Native

```json
{
Expand Down
70 changes: 24 additions & 46 deletions index.js
Expand Up @@ -7,35 +7,50 @@ module.exports = {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['eslint-comments'],
plugins: ['eslint-comments', 'prettier'],
extends: [
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
rules: {
// TypeScript (@typescript-eslint/eslint-plugin)
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
'@typescript-eslint/camelcase': ['error', { properties: 'always' }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-use-before-define': ['error', { variables: false }],
'@typescript-eslint/no-unused-vars': [
'warn',
{
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/prefer-interface': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-types': [
'error',
{
types: {
Boolean: { message: 'Use boolean instead', fixWith: 'boolean' },
Number: { message: 'Use number instead', fixWith: 'number' },
String: { message: 'Use string instead', fixWith: 'string' },
Symbol: { message: 'Use symbol instead', fixWith: 'symbol' },
},
},
],

// ESLint (eslint-plugin-eslint-comments)
'eslint-comments/no-unused-disable': 'warn',

// Other
// Custom
'array-callback-return': 'warn',
// Disabling "camelcase" in favor of "@typescript-eslint/camelcase"
camelcase: 'off',
curly: 'warn',
'dot-notation': 'warn',
'eol-last': 'warn',
eqeqeq: ['error', 'always', { null: 'never' }],
'guard-for-in': 'warn',
// Disabling "indent" because it gets confused with JSX in some cases.
indent: 'off',
'no-alert': 'warn',
'no-console': 'warn',
'no-debugger': 'warn',
Expand All @@ -51,42 +66,5 @@ module.exports = {
'prefer-const': 'off',
radix: 'warn',
yoda: 'warn',

// Code Style
'array-bracket-spacing': ['warn', 'never'],
'arrow-parens': 'warn',
'arrow-spacing': 'warn',
'object-curly-spacing': ['warn', 'always'],
'brace-style': ['warn', '1tbs', { allowSingleLine: false }],
'comma-dangle': ['warn', 'always-multiline'],
'comma-spacing': 'warn',
'jsx-quotes': ['warn', 'prefer-double'],
'key-spacing': 'warn',
'keyword-spacing': 'warn',
'no-extra-parens': ['warn', 'functions'],
'no-extra-semi': 'warn',
'no-mixed-spaces-and-tabs': 'warn',
'no-multi-spaces': 'warn',
'no-spaced-func': 'warn',
'no-trailing-spaces': 'warn',
quotes: [
'warn',
'single',
{ avoidEscape: true, allowTemplateLiterals: true },
],
'semi-spacing': 'warn',
semi: 'warn',
'space-before-blocks': 'warn',
'space-before-function-paren': [
'warn',
{
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
},
],
'space-in-parens': 'warn',
'space-infix-ops': 'warn',
'space-unary-ops': 'warn',
},
};
10 changes: 3 additions & 7 deletions package.json
@@ -1,19 +1,15 @@
{
"name": "eslint-config-kodefox",
"version": "0.0.1",
"description": "Default KodeFox style for TypeScript project.",
"version": "0.1.0",
"repository": "github:kodefox/eslint-config-kodefox",
"main": "index.js",
"files": [
"index.js",
"react.js",
"react-native.js"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "KodeFox",
"license": "MIT",
"author": "devteam@kodefox.com",
"license": "ISC",
"peerDependencies": {
"eslint": ">=5.0.0",
"prettier": ">=1.0.0"
Expand Down