Skip to content

Commit

Permalink
Upgrade lint version (#20)
Browse files Browse the repository at this point in the history
* Upgrade eslint

* Upgrade eslint and adjust configuration

* style: format code with Prettier

This commit fixes the style issues introduced in aab2191 according to the output
from Prettier.

Details: #20

* upgrade eslint from scratch

* style: format code with Prettier

This commit fixes the style issues introduced in 2d95ed1 according to the output
from Prettier.

Details: #20

* Update yarn.lock file

* Delete global from eslint configuration

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
ayelenmurano and deepsource-autofix[bot] authored Nov 6, 2024
1 parent f99a103 commit ff90502
Show file tree
Hide file tree
Showing 7 changed files with 494 additions and 391 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

56 changes: 0 additions & 56 deletions .eslintrc.json

This file was deleted.

Binary file added bun.lockb
Binary file not shown.
107 changes: 107 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import promise from 'eslint-plugin-promise'
import react from 'eslint-plugin-react'
import tsdoc from 'eslint-plugin-tsdoc'
import unusedImports from 'eslint-plugin-unused-imports'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
{
ignores: ['**/.next', '**/.git', '**/node_modules', '**/public'],
},
...fixupConfigRules(
compat.extends(
'next/core-web-vitals',
'prettier',
'turbo',
'plugin:react/recommended',
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
)
),
{
plugins: {
'unused-imports': unusedImports,
'@typescript-eslint': fixupPluginRules(typescriptEslint),
react: fixupPluginRules(react),
tsdoc,
promise,
},

languageOptions: {
parser: tsParser,
},

settings: {
react: {
version: 'detect',
},
},

rules: {
'tsdoc/syntax': 'off',

'no-restricted-imports': [
'warn',
{
patterns: [
{
group: ['@mui/(?!material/styles/createTypography)\\w+/\\w+/\\w+'],
message: 'Importing from subdirectories is restricted. Use top-level exports where available.',
},
],

paths: [
{
name: '@reduxjs/toolkit',
message: 'Please do not use Redux Toolkit, migrate to zustand.',
},
{
name: 'react-transition-group',
message: 'Migrate to MUI or similar. This package is not well maintained.',
},
],
},
],
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',
curly: 'error',
'prefer-const': 'error',
'no-else-return': 'error',
'no-unneeded-ternary': 'error',
'no-alert': 'error',
'no-empty': 'error',
'no-loss-of-precision': 'off',
'no-extra-boolean-cast': 'off',
'no-useless-catch': 'error',
'require-await': 'error',
'no-constant-binary-expression': 'off',
'no-continue': 'error',
'react/no-unescaped-entities': 'error',
'promise/prefer-await-to-then': 'error',
'react-hooks/exhaustive-deps': 'error',
'no-console': 'error',
'no-undef': 'off',
'unused-imports/no-unused-imports': 'error',
'no-magic-numbers': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-direct-mutation-state': 'off',
'react/prop-types': 'off',
},
},
]
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"format:check": "FORCE_COLOR=1 prettier --check \"**/*.{js,jsx,ts,tsx,json,md,mdx,css,scss}\"",
"generate-data": "node tools/resources.ts",
"lint": "FORCE_COLOR=1 yarn lint:code && yarn lint:scss",
"lint:code": "FORCE_COLOR=1 next lint --max-warnings 100000",
"lint:code:fix": "FORCE_COLOR=1 next lint --fix",
"lint:code": "FORCE_COLOR=1 yarn eslint",
"lint:code:fix": "FORCE_COLOR=1 yarn eslint --fix",
"lint:deps": "npx depcheck",
"lint:fix": "yarn lint:code:fix && yarn lint:scss:fix && yarn format && sort-package-json",
"lint:scss": "FORCE_COLOR=1 stylelint --allow-empty-input \"**/*.scss\"",
"lint:scss:fix": "FORCE_COLOR=1 stylelint --allow-empty-input --fix \"**/*.scss\"",
"lint:scss": "FORCE_COLOR=1 stylelint --formatter verbose \"**/*.scss\"",
"lint:scss:fix": "FORCE_COLOR=1 stylelint --formatter verbose --fix \"**/*.scss\"",
"prepare:pr": "yarn lint:fix && yarn format && yarn docs && yarn turbo build && yarn test",
"start": "next start",
"test": "FORCE_COLOR=1 jest --coverage",
Expand Down Expand Up @@ -73,6 +73,7 @@
"@emotion/react": "^11.13.0",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.13.0",
"@eslint/compat": "^1.2.2",
"@ethereumjs/common": "^4.4.0",
"@ipld/dag-cbor": "^9.2.1",
"@ledgerhq/hw-transport": "^6.30.6",
Expand Down Expand Up @@ -170,13 +171,13 @@
"@types/tryghost__content-api": "^1.3.16",
"@types/typography": "^0.16.7",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"css-loader": "7.1.2",
"depcheck": "^1.4.7",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-next": "14.2.5",
"eslint": "^9.14.0",
"eslint-config-next": "14.2.16",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^1.13.4",
"eslint-plugin-promise": "^6.6.0",
Expand All @@ -193,11 +194,11 @@
"sass-loader": "^14.2.1",
"sort-package-json": "^2.10.0",
"style-loader": "^4.0.0",
"stylelint": "^16.8.2",
"stylelint": "^16.10.0",
"stylelint-checkstyle-formatter": "^0.1.2",
"stylelint-config-prettier-scss": "^1.0.0",
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-scss": "^6.5.0",
"stylelint-scss": "^6.8.1",
"ts-jest": "^29.2.4",
"ts-node": "^10.9.2",
"turbo": "^1.13.4",
Expand Down
6 changes: 3 additions & 3 deletions src/utils/serialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ describe('blobToArrayBuffer', () => {

describe('serializeZipFiles', () => {
it('Serialize zip files', async () => {
var zip = new JSZip()
const zip = new JSZip()

// The text file shouldn't be shown
zip.file('test1.txt', 'It is a test\n')

// The json and sol files should be shown
zip.file('test2.json', JSON.stringify({ key: 'It is a test' }))

var messages = zip.folder('messages')
const messages = zip.folder('messages')
messages?.file('test3.sol', 'It is a test\n')
const blob = await zip.generateAsync({ type: 'blob' })

Expand All @@ -83,7 +83,7 @@ describe('serializeZipFiles', () => {
})

it('If the file has not extension or the file name starts with __MACOSX/, it should be shown', async () => {
var zip = new JSZip()
const zip = new JSZip()

// The file without extension shouldn't be shown
zip.file('test1', 'It is a test\n')
Expand Down
Loading

0 comments on commit ff90502

Please sign in to comment.