Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Pursuing type-safety #2818

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I'm aware, ecmaVersion and sourceType are not required to configure @typescript-eslint/parser. It should pick up the relevant settings from tsconfig.json.

I've also found setting tsconfigRootDir: __dirname, to be useful in some scenarios like VS Code extensions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so too, but it complains about Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context for some reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a deeper dive into my own config and found that even though I leave these values out, a preset I extend from is actually adding it (eslint-config-airbnb-base). Sorry, I didn't realise. You're right in that it throws the error!

Learnt something new :)

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