Core plugin structure and configuration management for ESLint integration, providing the foundational plugin object with rules, configurations, and utility functions.
The primary plugin export containing all rules, configurations, and utilities.
/**
* Main ESLint plugin export from eslint-plugin-ember
* @returns {ESLintPlugin} Complete plugin object for ESLint integration
*/
const eslintPluginEmber: ESLintPlugin;
interface ESLintPlugin {
/** Plugin metadata */
meta: {
/** Plugin name from package.json */
name: string;
/** Plugin version from package.json */
version: string;
};
/** Collection of all 97 ESLint rules */
rules: Record<string, ESLintRule>;
/** Legacy configuration presets */
configs: Record<string, ESLintConfig>;
/** Utility functions for rule development */
utils: {
/** Ember-specific utility functions */
ember: EmberUtils;
};
/** ESLint processors */
processors: {
/** No-op processor for template files */
noop: ESLintProcessor;
};
}Usage Example:
// Direct plugin usage
const eslintPluginEmber = require('eslint-plugin-ember');
// Access specific components
const emberRules = eslintPluginEmber.rules;
const emberConfigs = eslintPluginEmber.configs;
const emberUtils = eslintPluginEmber.utils.ember;Access to plugin metadata for version checking and identification.
/**
* Plugin metadata containing name and version
*/
interface PluginMeta {
/** Package name: "eslint-plugin-ember" */
name: string;
/** Current package version */
version: string;
}Usage Example:
const plugin = require('eslint-plugin-ember');
console.log(`Using ${plugin.meta.name} v${plugin.meta.version}`);Direct access to individual ESLint rules for custom configuration.
/**
* Individual rule access from the rules collection
* All rule names are prefixed with 'ember/' when used in ESLint configs
*/
interface RuleCollection {
/** Component-related rules */
'no-actions-hash': ESLintRule;
'no-attrs-in-components': ESLintRule;
'no-classic-components': ESLintRule;
'no-component-lifecycle-hooks': ESLintRule;
'order-in-components': ESLintRule;
/** Route-related rules */
'no-capital-letters-in-routes': ESLintRule;
'no-controller-access-in-routes': ESLintRule;
'route-path-style': ESLintRule;
'routes-segments-snake-case': ESLintRule;
'order-in-routes': ESLintRule;
/** Service-related rules */
'no-implicit-injections': ESLintRule;
'no-unnecessary-service-injection-argument': ESLintRule;
'no-unused-services': ESLintRule;
/** Computed property rules */
'no-arrow-function-computed-properties': ESLintRule;
'no-computed-properties-in-native-classes': ESLintRule;
'no-duplicate-dependent-keys': ESLintRule;
'require-computed-property-dependencies': ESLintRule;
/** Test-related rules */
'no-legacy-test-waiters': ESLintRule;
'no-test-and-then': ESLintRule;
'prefer-ember-test-helpers': ESLintRule;
/** Migration and deprecation rules */
'classic-decorator-hooks': ESLintRule;
'new-module-imports': ESLintRule;
'no-deprecated-router-transition-methods': ESLintRule;
'no-get': ESLintRule;
'no-old-shims': ESLintRule;
// ... all 97 rules available
}Usage Example:
const plugin = require('eslint-plugin-ember');
// Access specific rule
const noActionsHashRule = plugin.rules['no-actions-hash'];
// Use in custom config
module.exports = {
plugins: ['ember'],
rules: {
'ember/no-actions-hash': 'error',
'ember/no-jquery': 'warn'
}
};Access to pre-built legacy ESLint configurations.
/**
* Legacy configuration presets for traditional ESLint setup
*/
interface LegacyConfigs {
/** Base configuration */
base: ESLintConfig;
/** Recommended configuration with essential rules */
recommended: ESLintConfig;
/** Configuration for .gjs files */
'recommended-gjs': ESLintConfig;
/** Configuration for .gts files */
'recommended-gts': ESLintConfig;
}Usage Example:
const plugin = require('eslint-plugin-ember');
// Access legacy configs
const recommendedConfig = plugin.configs.recommended;
// Use in .eslintrc.js
module.exports = {
extends: ['plugin:ember/recommended']
};Access to ESLint processors for special file handling.
/**
* ESLint processors for handling special file types
*/
interface ProcessorCollection {
/** No-op processor for .gjs/.gts template files */
noop: ESLintProcessor;
}Usage Example:
const plugin = require('eslint-plugin-ember');
// Access processor
const noopProcessor = plugin.processors.noop;
// Used automatically in modern configsAccess to Ember-specific utility functions for custom rule development.
/**
* Utility function access for advanced usage
*/
interface UtilityAccess {
/** Ember-specific AST analysis utilities */
ember: EmberUtils;
}Usage Example:
const plugin = require('eslint-plugin-ember');
const emberUtils = plugin.utils.ember;
// Use in custom rule development
const isEmberComponent = emberUtils.isEmberComponent(context, node);
const isComputedProp = emberUtils.isComputedProp(node, 'Ember', 'computed');