Skip to content

Commit fc6f737

Browse files
author
Guilherme Araújo
authored
Set up ESLint and Prettier (#12)
* Set up Prettier * Set up ESLint * Create .editorconfig * Create pre-commit hook * chore: add eslint rules link
1 parent 7290e52 commit fc6f737

7 files changed

+1817
-0
lines changed

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
max_line_length = 80

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.lintstagedrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{js,jsx,ts,tsx,mjs}": ["eslint --fix", "prettier --write"],
3+
"*.{json,yml}": ["prettier --write"]
4+
}

.prettierrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"semi": true,
5+
"singleQuote": true,
6+
"jsxSingleQuote": false,
7+
"trailingComma": "es5",
8+
"bracketSpacing": true,
9+
"bracketSameLine": false,
10+
"arrowParens": "avoid"
11+
}

eslint.config.mjs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import pluginJs from '@eslint/js';
2+
import eslintConfigPrettier from 'eslint-config-prettier';
3+
import globals from 'globals';
4+
5+
export default [
6+
{ languageOptions: { globals: globals.browser } },
7+
// Visit https://eslint.org/docs/latest/rules to learn more about these rules
8+
pluginJs.configs.recommended,
9+
eslintConfigPrettier,
10+
];

0 commit comments

Comments
 (0)