@splunk/eslint-config
v5.1.0
Published
Standardized Splunk ESLint configuration
Keywords
Readme
@splunk/eslint-config
This package provides extendable ESLint configuration objects. Currently, the following configs are available:
Traditional (ESLint 8, requires Babel):
browser- For code that runs in the browser.browser-prettier- For browser code that is formatted by prettier.node- For node scripts.node-prettier- For node scripts that are automatically formatted with prettier.
Flat Config (ESLint 9, Babel-free):
flat-browser- For modern toolchains (Vite + SWC, etc.) using ESLint 9 flat config format.flat-browser-prettier- For browser code with modern toolchains, formatted with prettier.
Install
Traditional Configs (ESLint 8, requires Babel)
For projects using Babel and the traditional .eslintrc format.
- Install the peer dependencies:
npm install --save-dev @babel/eslint-parser@7 eslint@^8 eslint-config-airbnb@^19 eslint-plugin-import@^2 eslint-plugin-jsx-a11y@^6 eslint-plugin-react@^7 eslint-plugin-react-hooks@^4 - Install the package:
npm install --save-dev @splunk/eslint-config
ESLint requires dependencies to be installed as peer dependencies. See this issue on github for more background.
Flat Config (ESLint 9, Babel-free)
For projects using ESLint 9's flat config format (works with any build tool: webpack, Vite, SWC, esbuild, etc.).
- Install the peer dependencies:
Fornpm install --save-dev @eslint/js@^9 eslint@^9 globals@^16 eslint-plugin-import@^2 eslint-plugin-jsx-a11y@^6.10.0 eslint-plugin-react@^7.37.1 eslint-plugin-react-hooks@^7flat-browser-prettier, also install:npm install --save-dev eslint-config-prettier - Install the package:
npm install --save-dev @splunk/eslint-config
Note: The flat config does not require @babel/eslint-parser or eslint-config-airbnb.
Choosing a Config
Use Traditional configs if:
- You're on ESLint 8
- Your project uses Babel for parsing (e.g., older webpack setups)
- You're using
.eslintrcformat
Use Flat configs if:
- You're on ESLint 9 or planning to upgrade
- Your build tool handles JSX natively (Vite, SWC, esbuild, modern webpack)
- You want to avoid the Babel dependency
The flat configs provide the same linting rules as the traditional configs but use ESLint 9's native flat config format and don't require Babel.
Usage
Add the appropriate entry to your eslint configuration:
{
extends: "@splunk/eslint-config/browser"
}Or
{
extends: "@splunk/eslint-config/browser-prettier"
}Or
{
extends: "@splunk/eslint-config/node"
}Or
{
extends: "@splunk/eslint-config/node-prettier"
}Or
import splunkConfig from '@splunk/eslint-config/flat-browser.mjs';
export default [
...splunkConfig,
// Your additional configuration
];Or
import splunkConfig from '@splunk/eslint-config/flat-browser-prettier.mjs';
export default [
...splunkConfig,
// Your additional configuration
];