Skip to content

Commit

Permalink
upgrade dev tooling setup
Browse files Browse the repository at this point in the history
- force `git` to keep original line-endings (tests fail otherwise)

- pin `@types/node` to v8 (was: v10)
- update `eslint` and plugins
- update `typescript`, `tslib`, `ts-node`

- add typescript's native typechecking as `typecheck` npm script
- add `typescript-eslint` and enable linting in ts files

- remove redundant eslint rules
- add `eol-last`, `no-trailing-spaces` and `dot-notation` rules

`eslint`, `prettier` and `editorconfig` settings used to conflict
with each other, so I aligned them (where possible) to the `eslint`
rules

TODO: fix all linting errors in typescript
TODO: refactor typescript interfaces to make compilation type-safe
  • Loading branch information
mrkishi committed May 18, 2019
1 parent 7265fd4 commit 32a47c5
Show file tree
Hide file tree
Showing 9 changed files with 548 additions and 305 deletions.
14 changes: 5 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true

[test/**/expected.css]
indent_style = tab
insert_final_newline = false
trim_trailing_whitespace = true

[{package.json,.travis.yml,.eslintrc.json}]
indent_style = space
indent_size = 2
[.travis.yml]
indent_style = space
52 changes: 52 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module.exports = {
root: true,

rules: {
// automatically fixable stylistic rules
'arrow-spacing': 2,
'comma-dangle': [2, 'never'],
'dot-notation': 2,
'eol-last': [2, 'never'],
indent: [2, 'tab', { SwitchCase: 1 }],
'keyword-spacing': [2, { before: true, after: true }],
'no-trailing-spaces': 2,
'no-var': 2,
'object-shorthand': [2, 'always'],
'one-var': [2, 'never'],
'prefer-arrow-callback': 2,
'prefer-const': [2, { destructuring: 'all' }],
'quote-props': [2, 'as-needed'],
semi: [2, 'always'],
'space-before-blocks': [2, 'always'],

// eslint:recommended overrides
'no-cond-assign': 0,
'no-inner-declarations': 0,
'no-mixed-spaces-and-tabs': [2, 'smart-tabs']
},

plugins: ['@typescript-eslint'],

extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript'
// TODO: fix typerscript files
// 'plugin:@typescript-eslint/recommended',
],

parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 9,
sourceType: 'module',
project: './tsconfig.json'
},

env: {
es6: true,
browser: true,
node: true,
mocha: true
}
};
44 changes: 0 additions & 44 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.svelte linguist-language=HTML
* text=auto eol=lf
*.svelte linguist-language=HTML
3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

9 changes: 9 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
arrowParens: 'avoid',
endOfLine: 'lf',
quoteProps: 'as-needed',
semi: true,
singleQuote: true,
trailingComma: 'none',
useTabs: true
};
Loading

0 comments on commit 32a47c5

Please sign in to comment.