Skip to content

Commit

Permalink
chore(repo): Update rules to be more in-line with current expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
tmilewski committed Oct 19, 2023
1 parent fe133d4 commit 17f941c
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 12 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/eslint-config-custom/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const disabledRules = {

// TODO: All rules below should be set to their defaults
// when we're able to make the appropriate changes.
'jest/expect-expect': 'off',
'jest/no-alias-methods': 'off',
'jest/no-commented-out-tests': 'off',
'jest/no-disabled-tests': 'off',
'jest/no-conditional-expect': 'off',
'jest/no-duplicate-hooks': 'off',
'jest/no-export': 'off',
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint-config-custom/qunit.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const disabledRules = {
'qunit/no-assert-equal': 'off',
};

module.exports = {
extends: ['plugin:qunit/recommended'],
env: {
Expand All @@ -8,5 +12,6 @@ module.exports = {
'qunit/no-assert-equal': 'warn',
'qunit/no-conditional-assertions': 'warn',
'qunit/no-early-return': 'warn',
...disabledRules,
},
};
9 changes: 7 additions & 2 deletions packages/eslint-config-custom/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ const disabledRules = {
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/html-has-lang': 'warn',
'jsx-a11y/no-autofocus': 'warn',
'react/display-name': 'warn',
'react/button-has-type': 'warn',
'react/display-name': 'off',
'react/jsx-curly-brace-presence': 'off',
'react/jsx-no-leaked-render': 'off',
'react/jsx-no-useless-fragment': 'warn',
'react/jsx-sort-props': 'off',
'react-hooks/rules-of-hooks': 'warn',
};

Expand All @@ -34,7 +39,7 @@ module.exports = {
},
],
'react/button-has-type': 'warn',
'react/function-component-definition': 'warn',
'react/function-component-definition': 'off',
'react/hook-use-state': 'warn',
'react/jsx-boolean-value': 'warn',
'react/jsx-curly-brace-presence': 'warn',
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-custom/rules/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module.exports = {
'no-label-var': 'error',
'no-undef-init': 'warn',
'no-unused-vars': [
'error',
'warn',
{
args: 'after-used',
argsIgnorePattern: '^_',
ignoreRestSiblings: false,
ignoreRestSiblings: true,
vars: 'all',
varsIgnorePattern: '^_',
},
Expand Down
11 changes: 9 additions & 2 deletions packages/eslint-config-custom/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const disabledRules = {

// TODO: All rules below should be set to their defaults
// when we're able to make the appropriate changes.
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/no-floating-promises': [
Expand All @@ -33,7 +34,6 @@ const disabledRules = {
ignoreVoid: true,
},
],
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/require-await': 'warn',
};

Expand All @@ -58,7 +58,14 @@ module.exports = {
'prettier',
],
rules: {
'@typescript-eslint/ban-ts-comment': [`warn`, { 'ts-ignore': `allow-with-description` }],
'@typescript-eslint/ban-ts-comment': [
`warn`,
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
'ts-check': 'allow-with-description',
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/globs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import globToRegexp from 'glob-to-regexp';

export const globs = {
toRegexp: (pattern: string) => {
toRegexp: (pattern: string): RegExp => {
try {
return globToRegexp(pattern) as RegExp;
return globToRegexp(pattern);
} catch (e: any) {
throw new Error(
`Invalid pattern: ${pattern}.\nConsult the documentation of glob-to-regexp here: https://www.npmjs.com/package/glob-to-regexp.\n${e.message}`,
Expand Down

0 comments on commit 17f941c

Please sign in to comment.