or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

array-formatting.mdcode-quality-consistency.mdfunction-formatting.mdindex.mdline-breaks-newlines.mdmodern-javascript.mdobject-formatting.mdplugin-configuration.mdpunctuation-operators.mdspacing-indentation.md

plugin-configuration.mddocs/

0

# Plugin Configuration

1

2

This document covers the main plugin object and configuration presets provided by @stylistic/eslint-plugin-js.

3

4

## Plugin Object

5

6

The main export is an ESLint plugin object containing all 70 stylistic rules and pre-built configuration presets.

7

8

```javascript { .api }

9

interface Plugin {

10

rules: Rules;

11

configs: {

12

'disable-legacy': Linter.Config;

13

'all': Linter.Config;

14

'all-flat': Linter.Config;

15

};

16

}

17

18

declare const plugin: Plugin;

19

export default plugin;

20

```

21

22

### Usage Example

23

24

```javascript

25

import stylisticJs from '@stylistic/eslint-plugin-js';

26

27

export default [

28

{

29

plugins: {

30

'@stylistic/js': stylisticJs

31

},

32

rules: {

33

'@stylistic/js/indent': ['error', 2],

34

'@stylistic/js/semi': ['error', 'always']

35

}

36

}

37

];

38

```

39

40

## Configuration Presets

41

42

### configs.all

43

44

Enables all 70 stylistic rules with their default/recommended settings. This configuration uses the flat config format and is ideal for projects that want comprehensive stylistic enforcement.

45

46

```javascript { .api }

47

const all: Linter.Config;

48

```

49

50

**Usage:**

51

52

```javascript

53

import stylisticJs from '@stylistic/eslint-plugin-js';

54

55

export default [

56

stylisticJs.configs.all

57

];

58

```

59

60

### configs['disable-legacy']

61

62

Disables all 70 legacy ESLint core stylistic rules that conflict with this plugin's rules. This prevents rule conflicts when migrating from ESLint core stylistic rules to @stylistic rules. Works with both flat and legacy config formats.

63

64

**Important**: Use this config when you want to avoid "Definition for rule was not found" errors from deprecated ESLint core rules.

65

66

```javascript { .api }

67

const disableLegacy: Linter.Config;

68

```

69

70

**Usage:**

71

72

```javascript

73

import stylisticJs from '@stylistic/eslint-plugin-js';

74

75

export default [

76

stylisticJs.configs['disable-legacy'],

77

// your other configs...

78

];

79

```

80

81

### configs['all-flat'] (Deprecated)

82

83

Alias for `configs.all`. Use `configs.all` instead.

84

85

```javascript { .api }

86

const allFlat: Linter.Config; // @deprecated use 'all' instead

87

```

88

89

## Individual Rule Access

90

91

All 70 rules are available through the `rules` object or as individual exports from their respective paths:

92

93

```javascript { .api }

94

// Through plugin object

95

const indentRule = stylisticJs.rules.indent;

96

const quotesRule = stylisticJs.rules.quotes;

97

98

// As individual imports (all 70 rules available)

99

import indentRule from '@stylistic/eslint-plugin-js/rules/indent';

100

import quotesRule from '@stylistic/eslint-plugin-js/rules/quotes';

101

import semiRule from '@stylistic/eslint-plugin-js/rules/semi';

102

import arrayBracketSpacing from '@stylistic/eslint-plugin-js/rules/array-bracket-spacing';

103

// ... pattern continues for all 70 rules

104

```

105

106

**Available individual rule exports** (all follow the pattern `@stylistic/eslint-plugin-js/rules/{rule-name}`):

107

108

- Array rules: `array-bracket-newline`, `array-bracket-spacing`, `array-element-newline`

109

- Function rules: `function-call-spacing`, `function-paren-newline`, `space-before-function-paren`

110

- Object rules: `object-curly-spacing`, `object-curly-newline`, `object-property-newline`

111

- Spacing rules: `indent`, `space-before-blocks`, `space-infix-ops`, `keyword-spacing`

112

- Punctuation rules: `semi`, `quotes`, `comma-dangle`, `comma-spacing`

113

- Modern JS rules: `arrow-parens`, `arrow-spacing`, `template-curly-spacing`

114

- And 49 additional rules covering all aspects of JavaScript formatting

115

116

## TypeScript Support

117

118

Complete TypeScript definitions are provided:

119

120

```typescript { .api }

121

import type { Rules, UnprefixedRuleOptions } from '@stylistic/eslint-plugin-js';

122

123

// Type for all rule modules

124

type Rules = {

125

[K in keyof UnprefixedRuleOptions]: Rule.RuleModule

126

};

127

128

// Type for rule options

129

type RuleOptions = {

130

'@stylistic/js/indent': ['off' | 'warn' | 'error', number | 'tab', IndentOptions?];

131

'@stylistic/js/semi': ['off' | 'warn' | 'error', 'always' | 'never', SemiOptions?];

132

// ... all other rules

133

};

134

```

135

136

## Configuration Helper Types

137

138

```typescript { .api }

139

// For eslint-define-config users

140

declare module 'eslint-define-config' {

141

export interface CustomRuleOptions extends RuleOptions {}

142

}

143

```