From da97faa144e89e92572bf117858d69a4267c4e3e Mon Sep 17 00:00:00 2001 From: Ashton Eby Date: Tue, 22 Oct 2024 15:57:56 -0700 Subject: [PATCH] feat: add prettier, update eslint with real rules --- README.md | 1 + config/.gitignore | 14 ++++++++++++++ config/eslint.config.js | 42 +++++++++++++++++++++++++++++++++-------- config/prettierrc.js | 12 ++++++++++++ package.json | 4 ++++ 5 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 config/prettierrc.js diff --git a/README.md b/README.md index 9fa1e6a..eb42368 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/config/.gitignore b/config/.gitignore index eac4fc4..8324406 100644 --- a/config/.gitignore +++ b/config/.gitignore @@ -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 diff --git a/config/eslint.config.js b/config/eslint.config.js index 9f08050..05900a6 100644 --- a/config/eslint.config.js +++ b/config/eslint.config.js @@ -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", + }, + }, ]; diff --git a/config/prettierrc.js b/config/prettierrc.js new file mode 100644 index 0000000..5de6d30 --- /dev/null +++ b/config/prettierrc.js @@ -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; diff --git a/package.json b/package.json index f2dccc4..e527ec6 100644 --- a/package.json +++ b/package.json @@ -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/" }