diff --git a/.eslintignore b/.eslintignore new file mode 100755 index 0000000..f478d15 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +.DS_Store +coverage +dist +node_modules \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..b5d5ddb --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,70 @@ +const prettierConf = require('./prettier.config'); + +module.exports = { + env: { + browser: true, + es6: true, + node: true, + }, + extends: [ + 'airbnb-base', + 'eslint:recommended', + 'plugin:@typescript-eslint/eslint-recommended', + 'prettier', + ], + globals: { + Atomics: 'readonly', + SharedArrayBuffer: 'readonly', + tw: true, + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2020, + ecmaFeatures: { + classes: true, + impliedStrict: true, + jsx: true, + }, + sourceType: 'module', + }, + plugins: ['prettier', '@typescript-eslint'], + rules: { + 'id-length': [ + 2, + { + exceptions: ['_', 'a', 'b', 'c', 'i', 'x', 'y', 'z'], + }, + ], + 'import/extensions': 0, + 'import/no-unresolved': [2, { caseSensitive: false }], + 'import/prefer-default-export': 0, + 'no-await-in-loop': 0, + 'no-console': [ + 'error', + { + allow: ['error', 'info'], + }, + ], + 'no-case-declarations': 0, + 'no-nested-ternary': 0, + 'no-restricted-syntax': [ + 'error', + 'FunctionExpression', + 'WithStatement', + "BinaryExpression[operator='in']", + ], + 'prettier/prettier': ['error', prettierConf], + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/no-useless-constructor': 'off', + '@typescript-eslint/no-explicit-any': 'off', + }, + settings: { + 'import/resolver': { + node: { + extensions: ['.js', '.ts'], + }, + }, + }, +}; diff --git a/.prettierignore b/.prettierignore new file mode 100755 index 0000000..6b84ee8 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,10 @@ +.DS_Store +.env +*.log +*.pid +*.seed +coverage +dist +lib-cov +logs +node_modules \ No newline at end of file diff --git a/prettier.config.js b/prettier.config.js new file mode 100755 index 0000000..ce38e37 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,21 @@ +module.exports = { + arrowParens: 'avoid', + bracketSpacing: true, + endOfLine: 'auto', + overrides: [ + { + files: '*.json', + options: { + printWidth: 200, + }, + }, + ], + printWidth: 80, + proseWrap: 'preserve', + requirePragma: false, + semi: true, + singleQuote: true, + tabWidth: 2, + trailingComma: 'es5', + useTabs: false, +};