Skip to content

Commit 476bb6c

Browse files
committed
chore: add airbnb style lint config
1 parent 8e03b1b commit 476bb6c

File tree

7 files changed

+239
-114
lines changed

7 files changed

+239
-114
lines changed

.lintstagedrc.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"apps/**/*.{js,ts,jsx,tsx}": ["eslint --config eslint.config.js --fix"],
3-
"packages/ui/**/*.{js,ts,jsx,tsx}": [
4-
"eslint --config eslint.config.js --fix"
5-
],
6-
"*.json": ["prettier --write"]
2+
"apps/**/*.{js,ts,jsx,tsx}": ["eslint --config eslint.config.js --fix"],
3+
"packages/ui/**/*.{js,ts,jsx,tsx}": [
4+
"eslint --config eslint.config.js --fix"
5+
],
6+
"*.json": ["prettier --write"]
77
}

.prettierrc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
2-
"trailingComma": "es5",
3-
"tabWidth": 2,
42
"semi": true,
3+
"trailingComma": "es5",
54
"singleQuote": true,
6-
"printWidth": 80
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"useTabs": true,
8+
"bracketSpacing": true,
9+
"arrowParens": "always",
10+
"endOfLine": "auto"
711
}

eslint.config.js

Lines changed: 91 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import js from "@eslint/js";
2-
import globals from "globals";
3-
import reactRecommended from "eslint-plugin-react/configs/recommended.js";
4-
import reactJsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js";
5-
import typescript from "typescript-eslint";
1+
import path from 'path';
2+
import js from '@eslint/js';
3+
import globals from 'globals';
4+
import reactRecommended from 'eslint-plugin-react/configs/recommended.js';
5+
import reactJsxRuntime from 'eslint-plugin-react/configs/jsx-runtime.js';
6+
import typescript from 'typescript-eslint';
7+
import importPlugin from 'eslint-plugin-import';
8+
import reactPlugin from 'eslint-plugin-react';
9+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
10+
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
611

712
export default [
813
// Base configurations
@@ -14,39 +19,106 @@ export default [
1419
// Global ignores
1520
{
1621
ignores: [
17-
"**/node_modules/*",
18-
"**/dist/*",
19-
"**/build/*",
20-
"**/*.config.js",
21-
".turbo",
22-
".next"
22+
'**/node_modules/*',
23+
'**/dist/*',
24+
'**/build/*',
25+
'**/*.config.js',
26+
'.turbo',
27+
'.next',
28+
'**/coverage/*',
29+
'**/public/*'
2330
]
2431
},
2532

2633
// Configuration for JavaScript and TypeScript files
2734
{
2835
files: [
29-
"apps/**/*.{js,jsx,ts,tsx}",
30-
"packages/**/*.{js,jsx,ts,tsx}"
36+
'packages/**/*.{js,jsx,ts,tsx}',
37+
'**/*.{js,jsx,ts,tsx}'
3138
],
39+
plugins: {
40+
import: importPlugin,
41+
react: reactPlugin,
42+
'react-hooks': reactHooksPlugin,
43+
'jsx-a11y': jsxA11yPlugin
44+
},
3245
languageOptions: {
3346
globals: {
3447
...globals.browser,
3548
...globals.node
3649
},
3750
parserOptions: {
38-
ecmaVersion: "latest",
39-
sourceType: "module",
51+
ecmaVersion: 'latest',
52+
sourceType: 'module',
4053
ecmaFeatures: {
4154
jsx: true
4255
}
4356
}
4457
},
58+
settings: {
59+
'import/resolver': {
60+
typescript: {
61+
project: ['./tsconfig.json']
62+
}
63+
},
64+
react: {
65+
version: 'detect'
66+
}
67+
},
4568
rules: {
46-
// Customize rules for your Turborepo
47-
"no-unused-vars": "warn",
48-
"react/prop-types": "off",
49-
"react/react-in-jsx-scope": "off"
69+
// TypeScript-specific rules
70+
'@typescript-eslint/no-unused-vars': 'warn',
71+
'@typescript-eslint/no-explicit-any': 'warn',
72+
73+
// React specific rules
74+
'react/jsx-filename-extension': [1, {
75+
extensions: ['.js', '.jsx', '.ts', '.tsx']
76+
}],
77+
'react/function-component-definition': [2, {
78+
namedComponents: 'arrow-function',
79+
unnamedComponents: 'arrow-function'
80+
}],
81+
'react/react-in-jsx-scope': 'off',
82+
83+
// Import and module rules
84+
'import/extensions': ['error', 'ignorePackages', {
85+
js: 'never',
86+
jsx: 'never',
87+
ts: 'never',
88+
tsx: 'never'
89+
}],
90+
'import/no-extraneous-dependencies': ['error', {
91+
devDependencies: [
92+
'**/*.test.{js,jsx,ts,tsx}',
93+
'**/*.spec.{js,jsx,ts,tsx}',
94+
'**/test/**/*.{js,jsx,ts,tsx}',
95+
'**/tests/**/*.{js,jsx,ts,tsx}'
96+
]
97+
}],
98+
99+
// Accessibility rules
100+
'jsx-a11y/anchor-is-valid': [
101+
'error',
102+
{
103+
components: ['Link'],
104+
specialLink: ['hrefLeft', 'hrefRight'],
105+
aspects: ['invalidHref', 'preferButton']
106+
}
107+
],
108+
109+
// Customizations
110+
'max-len': ['error', {
111+
code: 120,
112+
tabWidth: 2,
113+
ignoreUrls: true,
114+
ignoreComments: false,
115+
ignoreRegExpLiterals: true,
116+
ignoreStrings: true,
117+
ignoreTemplateLiterals: true
118+
}],
119+
'no-console': 'warn',
120+
'react-hooks/rules-of-hooks': 'error',
121+
'react-hooks/exhaustive-deps': 'warn'
50122
}
51123
}
52124
];

package.json

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
{
2-
"name": "proximity",
3-
"private": true,
4-
"scripts": {
5-
"dev": "turbo run dev",
6-
"build": "turbo run build",
7-
"test": "turbo run test",
8-
"lint": "turbo run lint",
9-
"clean": "turbo run clean && rm -rf node_modules",
10-
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\" --ignore-path .gitignore",
11-
"prepare": "husky"
12-
},
13-
"devDependencies": {
14-
"@commitlint/config-conventional": "^19.5.0",
15-
"@eslint/js": "^9.17.0",
16-
"@types/node": "^22.10.2",
17-
"eslint": "^9.17.0",
18-
"eslint-plugin-react": "^7.37.2",
19-
"globals": "^15.13.0",
20-
"husky": "^9.1.7",
21-
"lint-staged": "^15.2.11",
22-
"prettier": "^3.4.2",
23-
"turbo": "^2.3.3",
24-
"typescript": "^5.7.2",
25-
"typescript-eslint": "^8.18.0"
26-
},
27-
"engines": {
28-
"node": ">=18"
29-
},
30-
"packageManager": "pnpm@9.12.0"
2+
"name": "proximity",
3+
"private": true,
4+
"scripts": {
5+
"dev": "turbo run dev",
6+
"build": "turbo run build",
7+
"test": "turbo run test",
8+
"lint": "turbo run lint",
9+
"clean": "turbo run clean && rm -rf node_modules",
10+
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\" --ignore-path .gitignore",
11+
"prepare": "husky"
12+
},
13+
"devDependencies": {
14+
"@commitlint/config-conventional": "^19.5.0",
15+
"@eslint/js": "^9.17.0",
16+
"@types/node": "^22.10.2",
17+
"@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0",
18+
"@typescript-eslint/parser": "^5.0.0 || ^6.0.0",
19+
"eslint": "^9.17.0",
20+
"eslint-config-airbnb": "^19.0.4",
21+
"eslint-import-resolver-typescript": "^3.7.0",
22+
"eslint-plugin-import": "^2.31.0",
23+
"eslint-plugin-jsx-a11y": "^6.10.2",
24+
"eslint-plugin-react": "^7.37.2",
25+
"eslint-plugin-react-hooks": "^5.1.0",
26+
"globals": "^15.13.0",
27+
"husky": "^9.1.7",
28+
"lint-staged": "^15.2.11",
29+
"prettier": "^3.4.2",
30+
"turbo": "^2.3.3",
31+
"typescript": "^5.7.2",
32+
"typescript-eslint": "^8.18.0"
33+
},
34+
"engines": {
35+
"node": ">=18"
36+
},
37+
"packageManager": "pnpm@9.12.0"
3138
}

packages/database/src/prisma.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import './env'; // This ensures `process.env` is populated with the validated envs
2-
import { PrismaClient } from '@prisma/client';
1+
// import './env'; // This ensures `process.env` is populated with the validated envs
2+
// import { PrismaClient } from '@prisma/client';
33

4-
// Initialize Prisma
5-
const prisma = new PrismaClient();
4+
// // Initialize Prisma
5+
// const prisma = new PrismaClient();
66

7-
(async () => {
8-
try {
9-
await prisma.$connect();
10-
console.log('Database connected');
11-
} catch (error) {
12-
console.error('Database connection failed:', error);
13-
} finally {
14-
await prisma.$disconnect();
15-
}
16-
})();
7+
// (async () => {
8+
// try {
9+
// await prisma.$connect();
10+
// console.log('Database connected');
11+
// } catch (error) {
12+
// console.error('Database connection failed:', error);
13+
// } finally {
14+
// await prisma.$disconnect();
15+
// }
16+
// })();

packages/database/src/seed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const DEFAULT_USERS = [
2727
})
2828
)
2929
);
30-
} catch (error) {
31-
console.error(error);
30+
} catch {
31+
// console.error(error);
3232
process.exit(1);
3333
} finally {
3434
await db.$disconnect();

0 commit comments

Comments
 (0)