-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-linting.sh
More file actions
executable file
·67 lines (58 loc) · 1.79 KB
/
Copy pathsetup-linting.sh
File metadata and controls
executable file
·67 lines (58 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Setup script for code quality tools in jamium project
echo "🔧 Setting up code quality tools for jamium..."
# Install necessary dependencies
echo "📦 Installing dependencies..."
npm install --save-dev \
@ast-grep/cli \
eslint \
prettier \
husky \
@typescript-eslint/parser \
@typescript-eslint/eslint-plugin \
eslint-plugin-boundaries \
eslint-plugin-import \
eslint-plugin-storybook \
tsx
# Initialize Husky
echo "🐶 Initializing Husky..."
npx husky install
# Make Husky hooks executable
chmod +x .husky/commit-msg
chmod +x .husky/pre-commit
# Create .prettierrc if it doesn't exist
if [ ! -f .prettierrc ]; then
echo '{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 100,
"bracketSpacing": true,
"arrowParens": "avoid"
}' > .prettierrc
fi
# Add scripts to package.json
echo "📝 Adding scripts to package.json..."
node -e "
const fs = require('fs');
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
// Add lint and format scripts
packageJson.scripts = {
...packageJson.scripts,
'lint': 'eslint . --fix',
'lint:check': 'eslint .',
'format': 'prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"',
'format:check': 'prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"',
'test:ast-grep-rules': 'tsx scripts/test-ast-grep-rules.ts',
'ast-grep:scan': 'ast-grep scan',
'prepare': 'husky install'
};
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
console.log('✅ Scripts added to package.json');
"
echo "✨ Setup complete! You can now run:"
echo " npm run lint - Lint and fix code"
echo " npm run format - Format code with Prettier"
echo " npm run ast-grep:scan - Run ast-grep security checks"
echo " npm run test:ast-grep-rules - Test all linting rules"