Skip to content

Commit

Permalink
Add a Node specific config file
Browse files Browse the repository at this point in the history
This prevents warnings about not having React installed for Node-only
projects.
  • Loading branch information
rileytomasek committed Mar 3, 2024
1 parent 84d1b3d commit a93650a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ module.exports = {
extends: [ "@dexaai/eslint-config" ]
};
```

For Node-only projects (no React/browser code), use the `node` config:

```js filename=.eslintrc.js
module.exports = {
extends: [ "@dexaai/eslint-config/node" ]
};
```

37 changes: 37 additions & 0 deletions node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* This is a Node-specific config (without React).
*/

/**
* @see https://github.com/eslint/eslint/issues/3458
* @see https://www.npmjs.com/package/@rushstack/eslint-patch
*/
require('@rushstack/eslint-patch/modern-module-resolution');

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,

parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: true,
},

env: {
browser: false,
node: true,
es6: true,
},

extends: ['./config/core'].map(require.resolve),

overrides: ['./config/typescript', './config/tests', './config/prettier'].map(
require,
),

ignorePatterns: ['**/node_modules/**', '**/build/**', '**/dist/**'],

rules: {},
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"files": [
"README.md",
"config",
"index.js"
"index.js",
"node.js"
],
"scripts": {
"format": "prettier --write .",
Expand Down

0 comments on commit a93650a

Please sign in to comment.