From a279966aa500796bb2fb3b5d0f4f77a6a7203ed1 Mon Sep 17 00:00:00 2001 From: Shane Brunson Date: Tue, 7 May 2024 10:48:48 -0500 Subject: [PATCH] add config for typescript browser --- .changeset/five-pens-serve.md | 5 +++ packages/eslint-config-grumbler/README.md | 7 ++++ .../eslintrc-typescript-browser.js | 37 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 .changeset/five-pens-serve.md create mode 100644 packages/eslint-config-grumbler/eslintrc-typescript-browser.js diff --git a/.changeset/five-pens-serve.md b/.changeset/five-pens-serve.md new file mode 100644 index 0000000..3934677 --- /dev/null +++ b/.changeset/five-pens-serve.md @@ -0,0 +1,5 @@ +--- +"@krakenjs/eslint-config-grumbler": minor +--- + +added eslintrc-typescript-browser config diff --git a/packages/eslint-config-grumbler/README.md b/packages/eslint-config-grumbler/README.md index 52142ad..2b595c0 100644 --- a/packages/eslint-config-grumbler/README.md +++ b/packages/eslint-config-grumbler/README.md @@ -8,6 +8,13 @@ This package assumes you are already using [Prettier](https://prettier.io/). npm install -D @krakenjs/eslint-config-grumbler ``` +### Config Files + +- `eslintrc-browser` - browser-based rules + FlowType +- `eslintrc-typescript-browser` - browser-based rules + TypeScript +- `eslintrc-typescript` - TypeScript rules +- `eslintrc-node` - node.js rules + ### Usage 1. Create a `.eslintrc.js` file at the root of your package. diff --git a/packages/eslint-config-grumbler/eslintrc-typescript-browser.js b/packages/eslint-config-grumbler/eslintrc-typescript-browser.js new file mode 100644 index 0000000..b7fb117 --- /dev/null +++ b/packages/eslint-config-grumbler/eslintrc-typescript-browser.js @@ -0,0 +1,37 @@ +/* @flow */ + +// eslint-disable-next-line import/no-commonjs +module.exports = { + extends: "./eslintrc-typescript", + + rules: { + "no-process-env": "error", + }, + + env: { + browser: true, + es6: true, + }, + + globals: { + window: true, + document: true, + performance: true, + assert: true, + + __TEST__: true, + __WEB__: true, + __ENV__: true, + __MIN__: true, + __DEBUG__: true, + __FILE_NAME__: true, + __TREE_SHAKE__: true, + __WINDOW__: true, + __GLOBAL__: true, + __LOCAL__: true, + __STAGE__: true, + __SANDBOX__: true, + __PRODUCTION__: true, + __UID__: true, + }, +};