Skip to content

Latest commit

 

History

History
29 lines (27 loc) · 841 Bytes

setup-expo-00-prettier-lintstaged.md

File metadata and controls

29 lines (27 loc) · 841 Bytes
npx create-expo-app --template &&
npx expo install eslint eslint-config-prettier eslint-config-universe eslint-plugin-react-hooks prettier lint-staged husky &&
npm pkg set scripts.prepare="husky install" &&
npm pkg set scripts.lint="npx eslint" &&
npx husky install &&
npx husky add .husky/pre-commit "npm run lint" &&
{ cat <<'EOF' > .eslintrc.json 
{
  "extends": ["universe", "plugin:react-hooks/recommended", "prettier"]
}
EOF
} &&
{ cat <<'EOF' > .lintstagedrc.js
const path = require("path"); 
const buildEslintCommand = (filenames) => 
  `next lint --fix --file ${filenames 
    .map((f) => path.relative(process.cwd(), f)) 
    .join(" --file ")}`;

module.exports = { 
  "*.{js,jsx,ts,tsx}": [buildEslintCommand],
};
EOF
} &&
echo '{}' > .prettierrc.json &&
git add . && git commit -m "init prettier, lint-staged, husky"