@splunk/eslint-config
v6.0.0
Published
Standardized Splunk ESLint configuration
Keywords
Readme
@splunk/eslint-config
This package provides extendable ESLint configuration objects. Currently, the following configs are available:
Available configs
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.
Does not require Babel - use these if your build tool handles JSX natively:
flat-browser- For modern toolchains (Vite + SWC, etc.) without Babel.flat-browser-prettier- For browser code with modern toolchains, formatted with prettier.
Install
- Install the package and its required peers:
npm install --save-dev @splunk/eslint-config eslint@^9 @eslint/js@^9 - If you are using the Babel-based configs, also install:
npm install --save-dev @babel/core@^7 @babel/eslint-parser@^7
Usage
CommonJS flat config
Use the CommonJS entrypoints from eslint.config.cjs when you want the Babel-based browser config or the node configs.
const { defineConfig } = require('eslint/config');
const browser = require('@splunk/eslint-config/browser');
module.exports = defineConfig(browser, {
// Your additional configuration
});const { defineConfig } = require('eslint/config');
const browserPrettier = require('@splunk/eslint-config/browser-prettier');
module.exports = defineConfig(browserPrettier, {
// Your additional configuration
});const { defineConfig } = require('eslint/config');
const node = require('@splunk/eslint-config/node');
module.exports = defineConfig(node, {
// Your additional configuration
});const { defineConfig } = require('eslint/config');
const nodePrettier = require('@splunk/eslint-config/node-prettier');
module.exports = defineConfig(nodePrettier, {
// Your additional configuration
});ESM Babel-free browser config
Use the flat-browser entrypoints from eslint.config.js / eslint.config.mjs when your toolchain handles JSX without Babel.
import splunkConfig from '@splunk/eslint-config/flat-browser.mjs';
export default [
...splunkConfig,
// Your additional configuration
];import splunkConfig from '@splunk/eslint-config/flat-browser-prettier.mjs';
export default [
...splunkConfig,
// Your additional configuration
];