{"id":19495,"library":"eslint-config-brightspace","title":"eslint-config-brightspace","description":"Shareable ESLint configuration for Brightspace projects. Version 2.12.1 is the latest stable release, updated as of February 2026, with a monthly release cadence driven by dependency bumps and fixes. It supports ESLint 7–9 and provides environment-specific configs (node, browser, Lit, React, testing). Unlike generic ESLint configs, it includes helper functions like `addExtensions` and `setDirectoryConfigs` for fine-grained control over file extensions and directory-level overrides. Notably, it migrated from deprecated `quotes` rule to `@stylistic/quotes` in v2.11.1, and adopted the flat config format (eslint.config.js) required by ESLint 9. This config is designed exclusively for D2L/Brightspace ecosystem but can serve as a reference for large-scale project configurations.","status":"active","version":"2.12.1","language":"javascript","source_language":"en","source_url":"https://github.com/Brightspace/eslint-config-brightspace","tags":["javascript","d2l","eslint","eslintconfig"],"install":[{"cmd":"npm install eslint-config-brightspace","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-brightspace","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-brightspace","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; the config requires ESLint 7–9","package":"eslint","optional":false},{"reason":"used to define global variables for different environments (browser, node, etc.)","package":"globals","optional":false},{"reason":"enforces import/export rules","package":"eslint-plugin-import","optional":false}],"imports":[{"note":"This package is ESM-only; CommonJS require will fail. Use import syntax in eslint.config.js.","wrong":"const nodeConfig = require('eslint-config-brightspace')","symbol":"nodeConfig","correct":"import { nodeConfig } from 'eslint-config-brightspace'"},{"note":"Default export is not available; always use named imports.","wrong":"import browserConfig from 'eslint-config-brightspace'","symbol":"browserConfig","correct":"import { browserConfig } from 'eslint-config-brightspace'"},{"note":"The addExtensions helper is also a named export; commonly used together with a config.","wrong":"","symbol":"addExtensions","correct":"import { addExtensions, nodeConfig } from 'eslint-config-brightspace'"},{"note":"setDirectoryConfigs replaces the cascading hierarchy from ESLint 8; ensure proper ordering.","wrong":"","symbol":"setDirectoryConfigs","correct":"import { setDirectoryConfigs, litConfig, nodeConfig, testingConfig } from 'eslint-config-brightspace'"}],"quickstart":{"code":"// eslint.config.js\nimport { nodeConfig, browserConfig, addExtensions } from 'eslint-config-brightspace';\n\nexport default [\n  ...browserConfig,\n  ...addExtensions(nodeConfig, ['.js', '.mjs']),\n  {\n    rules: {\n      'no-console': 'warn',\n    },\n  },\n];","lang":"javascript","description":"Shows how to combine browser and node configs with custom file extensions and an extra rule override."},"warnings":[{"fix":"Use import syntax in an ESM context (type: 'module' in package.json or .mjs extension).","message":"ESM-only package: This package uses ES modules. It cannot be imported with CommonJS require().","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Upgrade to v2.11.1 or later to use the stylistic version.","message":"Deprecated quotes rule: The 'quotes' rule has been replaced by '@stylistic/quotes' in v2.11.1.","severity":"deprecated","affected_versions":"<2.11.1"},{"fix":"Use eslint.config.js file; remove any .eslintrc.* files.","message":"Flat config only: This package uses the new flat config format (eslint.config.js) and does not support .eslintrc.* formats.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Ensure ESLint version is 7.x, 8.x, or 9.x. ESLint 10+ not supported without upgrade.","message":"ESLint compatibility limited to 7-9: v2.12.1 explicitly restricts peer dependency to ESLint 7, 8, and 9.","severity":"breaking","affected_versions":">=2.12.1"},{"fix":"Order configurations correctly: define global config first, then directory-specific overrides.","message":"setDirectoryConfigs forces prior configs to ignore specified directories: Configs applied via setDirectoryConfigs will be ignored by any previously defined configs for paths matching the directory.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use named imports like `import { nodeConfig } from 'eslint-config-brightspace'`.","message":"No default export: The package does not export a default configuration; always use named exports.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change to import syntax and ensure eslint.config.js is treated as ESM (e.g., set type: 'module' in package.json).","cause":"Trying to require an ESM-only package with CommonJS require() or using require() in eslint.config.js without ESM context.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/eslint-config-brightspace/index.js from /path/to/eslint.config.js not supported."},{"fix":"Upgrade to v2.11.1+ and install '@stylistic/eslint-plugin' if it's not automatically installed.","cause":"Using an older version (<2.11.1) that still uses the deprecated 'quotes' rule, or the plugin '@stylistic/eslint-plugin' is missing.","error":"Configuration for rule \"quotes\" is invalid: \"@stylistic/quotes\" has not been loaded."},{"fix":"Convert to eslint.config.js and use import syntax. Remove .eslintrc.* files.","cause":"Using .eslintrc.* format instead of eslint.config.js flat config.","error":"ESLint couldn't find the config \"eslint-config-brightspace\" to extend from. Please check that the name of the config is correct."},{"fix":"Ensure the first argument is a valid config array (e.g., nodeConfig) and the second argument is an object mapping directory names to config arrays.","cause":"Occurs when setDirectoryConfigs is called with incorrect arguments (e.g., missing config array).","error":"Cannot read properties of undefined (reading 'map')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}