Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevee committed Apr 30, 2024
1 parent 4856c29 commit 8b8e7d8
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
env: {
browser: true,
es6: true,
'jest/globals': true,
},
extends: ['eslint:recommended', 'plugin:react/recommended'],
globals: {
Expand All @@ -16,9 +17,10 @@ module.exports = {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'jest'],
rules: {
'no-unused-vars': 'off',
'no-undef': 0,
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 'error',
'react/prop-types': 0,
'react-hooks/rules-of-hooks': 'error',
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ jobs:

- name: Test
run: npm run test

- name: Lint
run: npm run lint
1 change: 0 additions & 1 deletion frontend/components/form/configure-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ const ConfigureField: React.FC<Props> = ({
)}
</Box>
)
return null
}

export default ConfigureField
2 changes: 1 addition & 1 deletion frontend/components/form/table-select.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { TablePicker, FormField, Box } from '@airtable/blocks/ui'
import { TablePicker, FormField } from '@airtable/blocks/ui'
import { Table } from '@airtable/blocks/models'
import Alert from '../common/alert'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import TestDriver from '@airtable/blocks-testing'
import '@testing-library/jest-dom'
import attachmentGenerators from './attachment'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const image: RandomGenerator = {
generate: ({ options }) => [
{ url: faker.image.urlLoremFlickr({ category: options.category }) },
],
preview: ({ options, field }) => (
preview: ({ options }) => (
<img
src={faker.image.urlLoremFlickr({
category: options.category,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'
import TestDriver from '@airtable/blocks-testing'
import checkboxGenerator from './checkbox'

const [checkbox] = checkboxGenerator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'
import { Box, Icon } from '@airtable/blocks/ui'
import { faker } from '@faker-js/faker'
import { FieldType } from '@airtable/blocks/models'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const singleSelect: RandomGenerator = {
id: 'singleSelect',
name: 'Single select',
types: [FieldType.SINGLE_SELECT],
generate: ({ options, field }) =>
generate: ({ field }) =>
field.options.choices[
Math.floor(Math.random() * field.options.choices.length)
],
Expand Down Expand Up @@ -34,7 +34,7 @@ const multipleSelect: RandomGenerator = {
return (
<>
{choices.map((choice) => (
<ChoiceToken choice={choice} marginRight={2} />
<ChoiceToken key={choice.id} choice={choice} marginRight={2} />
))}
</>
)
Expand Down
3 changes: 0 additions & 3 deletions frontend/components/hook/random-generator/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { useBase } from '@airtable/blocks/ui'
import { FieldType, Field, Base } from '@airtable/blocks/models'
import generators from './generators'

/**
* A hook that returns random generator functions.
*/
const useRandomGenerator = () => {
const base = useBase()

const getGenerators = (): RandomGenerator[] => generators

/**
Expand Down
1 change: 1 addition & 0 deletions frontend/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { FieldType, Field, Base } from '@airtable/blocks/models'

interface GenerateOptions {
Expand Down
30 changes: 28 additions & 2 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@typescript-eslint/parser": "^6.21.0",
"babel-plugin-module-resolver": "^5.0.0",
"eslint": "^8.56.0",
"eslint-plugin-jest": "^28.3.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^29.7.0",
Expand Down

0 comments on commit 8b8e7d8

Please sign in to comment.