Skip to content

Commit

Permalink
feat: update eslint rules based on team consensus
Browse files Browse the repository at this point in the history
Update eslint rules based on team consensus
  • Loading branch information
acd02 committed Jun 8, 2023
1 parent ae0b7b2 commit d20f04c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
18 changes: 9 additions & 9 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module.exports = {
overrides: [
{
files: ['**/*.test.ts', '**/*.test.tsx', '**/*.stories.tsx'],
files: ['**/*.tsx'],
rules: {
'max-lines-per-function': [1, { max: 300, skipBlankLines: true, skipComments: true }],
'max-nested-callbacks': [1, 4],
'no-console': 0,
'max-lines-per-function': [1, { max: 200, skipBlankLines: true, skipComments: true }],
},
},
{
files: ['**/*.tsx'],
files: ['**/*.test.ts', '**/*.test.tsx', '**/*.stories.tsx'],
rules: {
'max-lines-per-function': [1, { max: 150, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': [1, { max: 500, skipBlankLines: true, skipComments: true }],
'max-nested-callbacks': [1, 8],
'no-console': 0,
},
},
],
Expand Down Expand Up @@ -47,7 +47,7 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/prefer-interface': 0,
'@typescript-eslint/no-object-literal-type-assertion': 0,
'@typescript-eslint/no-shadow': 1,
'@typescript-eslint/no-shadow': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-use-before-define': [
Expand Down Expand Up @@ -83,8 +83,8 @@ module.exports = {
curly: [1, 'multi-line'],
'max-lines': [1, { max: 300, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': [1, { max: 100, skipBlankLines: true, skipComments: true }],
'max-depth': [2, 2],
'max-nested-callbacks': [1, 2],
'max-depth': [2, 5],
'max-nested-callbacks': [1, 5],
'newline-before-return': 1,
'no-console': [1, { allow: ['error'] }],
'no-debugger': 1,
Expand Down
1 change: 0 additions & 1 deletion packages/components/checkbox/src/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const CheckboxGroup = forwardRef<HTMLDivElement, CheckboxGroupProps>(
const current = useMemo(() => {
const handleCheckedChange = (checked: boolean, changed: string) => {
const values = value || []
/* eslint-disable-next-line max-nested-callbacks */
const modified = checked ? [...values, changed] : values.filter(val => val !== changed)

setValue(modified)
Expand Down
1 change: 0 additions & 1 deletion packages/components/form-field/src/FormFieldProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const FormFieldProvider = ({
}, [])

const handleMessageIdRemove = useCallback((msgId: string) => {
/* eslint-disable-next-line max-nested-callbacks */
setMessageIds(ids => ids.filter(current => current !== msgId))
}, [])

Expand Down
2 changes: 0 additions & 2 deletions packages/components/popover/src/Popover.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable max-nested-callbacks */
/* eslint-disable max-lines-per-function */
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { mockResizeObserver } from 'jsdom-testing-mocks'
Expand Down
1 change: 0 additions & 1 deletion packages/utils/tailwind-plugins/spark-theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ module.exports = plugin.withOptions(
Object.entries(themes).forEach(([key, value]) => {
if (key === 'default') return

/* eslint-disable-next-line @typescript-eslint/no-shadow */
const { missingItems, additionalItems } = retrieveArrayDifferences({
ref: getAllObjectKeys(themeUtils.defaultTheme),
comp: getAllObjectKeys(value),
Expand Down

0 comments on commit d20f04c

Please sign in to comment.