Skip to content

Commit

Permalink
feat: add prettier, update eslint with real rules
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo committed Oct 22, 2024
1 parent f187cfc commit da97faa
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ A collection of lint, format, and build configs used at Fauna for TypeScript pro
## Included configs (`./config/`)
- `eslint.config.js`, a minimal placeholder eslint config.
- `.gitignore`, a minimal placeholder .gitignore file.
- `prettierrc.js`, a minimal placeholder prettier config.
14 changes: 14 additions & 0 deletions config/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,17 @@
# the project's build step copies it from /config

node_modules

# fauna-shell
/.nyc_output
/dist
/tmp
/experiments
.test_config
.env
.idea
/.vscode
*.log
/coverage
test-results.xml
/.history
42 changes: 34 additions & 8 deletions config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
// eslint.config.js
module.exports = [
{
rules: {
semi: "error",
"prefer-const": "error"
}
}
// borrowed from fauna-shell
export default [
{
ignores: ["**/node_modules", ".history"],
},
{
languageOptions: {
ecmaVersion: 2020,
},

rules: {
"no-await-in-loop": "off",
"new-cap": "off",
"quote-props": "off",
"no-negated-condition": "off",
"no-warning-comments": "off",
"spaced-comment": "off",
"max-nested-callbacks": "off",
"no-else-return": "off",
"no-console": "off",
"no-multi-str": "off",
"no-prototype-builtins": "off",

"node/no-unsupported-features": "off",
camelcase: "off",
},
},
{
files: ["test/**/*.mjs"],

rules: {
"no-unused-expressions": "off",
},
},
];
12 changes: 12 additions & 0 deletions config/prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
trailingComma: "es5",
tabWidth: 4,
semi: false,
singleQuote: true,
};

module.exports = config;
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
"mentions-regex": "^2.0.3",
"parse-commit-message": "^5.0.4"
},
"peerDependencies": {
"eslint": "^9.12.0",
"prettier": "^3.3.3",
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
Expand Down

0 comments on commit da97faa

Please sign in to comment.