Skip to content

Commit

Permalink
Merge branch 'refactor', fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
luxaritas committed Sep 27, 2019
2 parents 9538100 + 409e704 commit 80a0c8e
Show file tree
Hide file tree
Showing 278 changed files with 15,849 additions and 14,253 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
__tests__/
*.d.ts
/src/eterna/mode/PoseEdit/PoseEditMode.ts
/src/eterna/pose2D
104 changes: 60 additions & 44 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,91 @@
module.exports = {
'extends': ['airbnb-base', 'plugin:@typescript-eslint/recommended'],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'project': './tsconfig.json'
},
'plugins': [
'@typescript-eslint'
],
// Some imports may be resolved via webpack aliases
'settings': {
// Some imports may be resolved via webpack aliases
'import/resolver': {
'webpack': {
'config': 'webpack.common.js'
}
}
},
'rules': {
// Broken
// This rule frequently throws up false positives with subclasses https://github.com/typescript-eslint/typescript-eslint/issues/52
'class-methods-use-this': 'off',
// Same with this one https://github.com/typescript-eslint/typescript-eslint/issues/586
'@typescript-eslint/no-unused-vars': 'off',
// Don't bug out due to TypeScript

// Prefer typescript-eslint version
'semi': 'off',
'@typescript-eslint/semi': 'error',

// Handled by typescript
'no-dupe-class-members': 'off',
'no-undef': 'off',
// typescript-eslint handles this one
'no-use-before-define': 'off',

// These aren't really a big issue and used well keep our code cleaner
'no-bitwise': 'off',
'no-continue': 'off',
'no-plusplus': 'off',
'no-underscore-dangle': 'off',
'no-fallthrough': ['error', { "commentPattern": "break[\\s\\w]*omitted" }],
'@typescript-eslint/no-use-before-define': ['error', {'classes': false}],
// Additionally, only use warn since internal members are marked without modifiers, since internal doesn't exist yet https://github.com/Microsoft/TypeScript/issues/5228
// NOTE: Some are public but marked `/* internal */`, awaiting https://github.com/Microsoft/TypeScript/issues/5228
'@typescript-eslint/explicit-member-accessibility': ['warn', {
"accessibility": "explicit",
'overrides': {'constructors': 'no-public'}
}],
'@typescript-eslint/no-angle-bracket-type-assertion': 'off',
'@typescript-eslint/explicit-function-return-type': ['off', {
'allowTypedFunctionExpressions': true
}],
'no-constant-condition': ['error', { 'checkLoops': false }],
// We like using for..of statements, so we have to redefine with everything else via the airbnb config (https://github.com/airbnb/javascript/blob/a510095acf20e3d96a94e6d0d0b26cfac71d2c7f/packages/eslint-config-airbnb-base/rules/style.js#L334)
'no-restricted-syntax': ['error',
{
'selector': 'ForInStatement',
'message': 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
'selector': 'LabeledStatement',
'message': 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
'selector': 'WithStatement',
'message': '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
// For everything here on out, keep at least for now, so as not to cause issues/slow down while porting.
// Discuss/review these later for final determinations
'indent': ['error', 4],
'camelcase': 'off',
'quotes': ['error', 'double'],
'object-curly-spacing': ['error', 'never'],
'prefer-const': 'off',
'lines-between-class-members': ['error', 'always', {'exceptAfterSingleLine': true}],
'comma-dangle': ['error', 'never'],
'max-len': ['warn', {'code': 120}],
'no-else-return': 'off',
// At least until the dynamic content changes to interfaces
'dot-notation': 'off',
// Outparams are used in some places to reduce allocations, however it'd be nice to have in general...
// Should probably reconfigure with ignorePropertyModificationsFor
'no-param-reassign': 'off',
// This is currently broken https://github.com/benmosher/eslint-plugin-import/issues/1152
'import/order': 'off',
// prefer-default-export hurts refactorability, and leads to style inconsistencies (enums can't be default-exported)
'import/prefer-default-export': 'off',
{
'selector': 'ForInStatement',
'message': 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
'selector': 'LabeledStatement',
'message': 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
'selector': 'WithStatement',
'message': '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],

// Stylistic preference
'comma-dangle': ['error', 'never'],
//'quotes': ['error', 'single'],
'max-len': ['error', {
'code': 120,
'ignoreTemplateLiterals': true,
'ignoreRegExpLiterals': true,
'ignoreUrls': true
}],
'lines-between-class-members': ['error', 'always', {'exceptAfterSingleLine': true}],
'object-curly-spacing': ['error', 'never'],
// This can be more readable depending on the situation
'no-else-return': 'off',
// const should really be used to indicate that something *shouldn't* change, not just that it doesn't
'prefer-const': 'off',
// This would be great if it could pick up when we reassign multiple properties, but it's all sorts of
// painful/less readable in a large number of of cases
'prefer-destructuring': 'off',

// Stuff to review, likely due to impending code changes
// This isn't generally great practice, but a couple portions of our code benefit from this.
'no-cond-assign': ['error', 'except-parens'],
// At least until the dynamic content changes to interfaces
'dot-notation': 'off',
'@typescript-eslint/no-explicit-any': 'off',
// Outparams are used in some places to reduce allocations, however it'd be nice to have in general...
// Should probably reconfigure with ignorePropertyModificationsFor
'no-param-reassign': 'off'
}
};
};

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CTestTestfile.cmake
# JetBrains CLion
vienna.cbp
nupack.cbp
vrna2.cbp
vienna2.cbp
LinearFold.cbp
cmake-build-debug/
cmake-build-release/
Expand Down
1 change: 1 addition & 0 deletions assets/__mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
1 change: 1 addition & 0 deletions assets/__mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
Loading

0 comments on commit 80a0c8e

Please sign in to comment.