Skip to content

Commit

Permalink
Configuring eslint for typescript and javascript. WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdunlapSP committed Apr 7, 2020
1 parent 3e1d686 commit e3e86bf
Show file tree
Hide file tree
Showing 6 changed files with 472 additions and 1,513 deletions.
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
trailingComma: 'none',
singleQuote: true,
printWidth: 120,
tabWidth: 2
};
2 changes: 0 additions & 2 deletions api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

module.exports = {
env: {
node: true,
Expand Down
37 changes: 29 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

module.exports = {
env: {
es6: true
Expand All @@ -8,19 +6,20 @@ module.exports = {
ecmaVersion: 2018
},
plugins: ['mocha'],
extends: 'eslint:recommended',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
rules: {
'arrow-body-style': ['error', 'as-needed'],
'arrow-parens': ['error', 'always'],
'arrow-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
camelcase: 'off',
'comma-dangle': ['error', 'never'],
'comma-style': [
'error',
'first',
{ exceptions: { ArrayExpression: true, ObjectExpression: true } }
],
'comma-style': ['error', 'first', { exceptions: { ArrayExpression: true, ObjectExpression: true } }],
complexity: ['error', 5],
'consistent-this': ['error', 'self'],
curly: ['error', 'all'],
Expand Down Expand Up @@ -89,6 +88,28 @@ module.exports = {
'func-names': 'off',
'prefer-arrow-callback': 'off'
}
},
{
files: ['*.ts'],
env: {
es6: true,
node: true,
mocha: true
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'mocha'],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{
functions: false,
classes: false,
variables: true
}
]
}
}
]
};
2 changes: 0 additions & 2 deletions lib.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

module.exports = {
parserOptions: {
sourceType: 'module'
Expand Down
Loading

0 comments on commit e3e86bf

Please sign in to comment.