Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
fix(lint): fix linting problems
Browse files Browse the repository at this point in the history
  • Loading branch information
heyqbnk committed Apr 10, 2024
1 parent ac2b453 commit 606d25b
Show file tree
Hide file tree
Showing 3 changed files with 1,578 additions and 16 deletions.
30 changes: 16 additions & 14 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
function regexp(regex) {
return [
new RegExp(regex.source + '.*[^\\u0000]$').source,
regex.source,
];
}

module.exports = {
env: {
browser: true,
Expand All @@ -16,6 +9,15 @@ module.exports = {
plugins: [
'simple-import-sort',
],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
babelOptions: {
babelrc: false,
configFile: false,
presets: ['@babel/preset-env', '@babel/preset-react'],
},
},
rules: {
// Sometimes this rule decreases readability.
'arrow-body-style': 0,
Expand Down Expand Up @@ -74,23 +76,23 @@ module.exports = {
groups: [
// Node.js builtins prefixed with `node:`.
// node:fs
regexp(/^node:/),
[/^node:/.source],

// Packages.
// react
regexp(/^@?\w/),
// solid-js
[/^@?\w/.source],

// Tsconfig alias.
// Jsconfig alias.
// ~/helpers
regexp(/^~\//),
[/^~\//.source],

// Parent imports.
// ../Typography.js
regexp(/^\.\.\//),
[/^\.\.\//.source],

// Current folder imports.
// ./utils.js
regexp(/^\.\/.+\.(?!s?css)/),
[/^\.\/.+\.(?!s?css)/.source],

// Styles.
// ./Typography.css
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"deploy": "gh-pages -d dist",
"dev": "vite",
"build": "vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix",
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0 --fix",
"preview": "vite preview",
"predeploy": "pnpm run build"
},
Expand All @@ -24,6 +24,10 @@
"react-router-dom": "^6.22.3"
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@babel/preset-react": "^7.24.1",
"@types/react": "^18.2.73",
"@vitejs/plugin-react-swc": "^3.6.0",
"eslint-config-airbnb": "^19.0.4",
Expand Down
Loading

0 comments on commit 606d25b

Please sign in to comment.