Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
fixed with:

    ./node_modules/.bin/eslint --format=unix packages/*/src/**/*.ts packages/*/src/*.ts --fix

fix #266
  • Loading branch information
justinmk committed Feb 2, 2024
1 parent fea2caf commit e728487
Show file tree
Hide file tree
Showing 18 changed files with 610 additions and 28 deletions.
49 changes: 47 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
module.exports = {
// extending prettier fucks up my vim...
extends: [
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'prettier',
],
plugins: ['import', 'prettier', '@typescript-eslint'],
plugins: ['unicorn', 'import', 'prettier', '@typescript-eslint'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 'latest',
sourceType: 'module',
},
env: {
node: true,
es2024: true,
},

rules: {
curly: 2, // Enforce braces on "if"/"for"/etc.
// Avoid accidental use of "==" instead of "===".
eqeqeq: 'error',
camelcase: ['error', { properties: 'never' }],
'class-methods-use-this': 'off',
'comma-dangle': [
Expand Down Expand Up @@ -44,13 +52,50 @@ module.exports = {
'import/extensions': 'off',
'import/prefer-default-export': 'off',

'@typescript-eslint/no-namespace': 'error',
// TODO: '@typescript-eslint/no-floating-promises': 'error', // Promises must catch errors or be awaited.
// TODO? '@typescript-eslint/no-unsafe-assignment': 'error',
// TODO? '@typescript-eslint/no-unsafe-return': 'error',
// TODO? '@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',

// Rules from https://github.com/sindresorhus/eslint-plugin-unicorn
// TODO: 'unicorn/no-useless-promise-resolve-reject': 'error',
// TODO: 'unicorn/prefer-event-target': 'error',
// TODO: 'unicorn/prefer-string-slice': 'error',
// TODO? 'unicorn/custom-error-definition': 'error',
// TODO? 'unicorn/prefer-json-parse-buffer': 'error',
// TODO? ESM modules https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-module.md
// 'unicorn/prefer-module': 'error',
// 'unicorn/no-null': 'error',
'unicorn/no-abusive-eslint-disable': 'error',
'unicorn/prefer-at': 'error',
'unicorn/prefer-negative-index': 'error',
'unicorn/prefer-regexp-test': 'error',
'unicorn/prefer-ternary': 'error',
'unicorn/no-unnecessary-polyfills': 'error',
'unicorn/no-useless-spread': 'error',
'unicorn/prefer-array-some': 'error',
'unicorn/prefer-blob-reading-methods': 'error',
'unicorn/prefer-code-point': 'error',
'unicorn/prefer-date-now': 'error',
'unicorn/prefer-dom-node-text-content': 'error',
'unicorn/prefer-includes': 'error',
'unicorn/prefer-keyboard-event-key': 'error',
'unicorn/prefer-modern-dom-apis': 'error',
'unicorn/prefer-modern-math-apis': 'error',
'unicorn/prefer-native-coercion-functions': 'error',
'unicorn/prefer-node-protocol': 'error',
'unicorn/prefer-object-from-entries': 'error',
'unicorn/prefer-reflect-apply': 'error',
'unicorn/prefer-string-trim-start-end': 'error',
'unicorn/prefer-type-error': 'error',
},

settings: {
Expand Down
Loading

0 comments on commit e728487

Please sign in to comment.