You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Allow languages to provide defaultLanguageOptions (#19003)
* feat: Default `languageOptions` for languages
* don't pass `languageOptions` from CLI when not needed
* update jsdoc
* update RuleTester
* add flat-config-array unit tests
* add linter test with no language options
* fix browser test
* remove `languageOptions.parser` check from `RuleTester`
* add RuleTester test with no language options
* update docs
* remove unnecessary check
* use `??` instead of `||`
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
* default `languageOptions` to an empty object
---------
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
Copy file name to clipboardExpand all lines: docs/src/extend/languages.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,6 +85,7 @@ A basic `Language` object must implement the following:
85
85
The following optional members allow you to customize how ESLint interacts with the object:
86
86
87
87
*`visitorKeys` - visitor keys that are specific to the AST or CST. This is used to optimize traversal of the AST or CST inside of ESLint. While not required, it is strongly recommended, especially for AST or CST formats that deviate significantly from ESTree format.
88
+
*`defaultLanguageOptions` - default `languageOptions` when the language is used. User-specified `languageOptions` are merged with this object when calculating the config for the file being linted.
88
89
*`matchesSelectorClass(className, node, ancestry)` - allows you to specify selector classes, such as `:expression`, that match more than one node. This method is called whenever an [esquery](https://github.com/estools/esquery) selector contains a `:` followed by an identifier.
89
90
90
91
See [`JSONLanguage`](https://github.com/eslint/json/blob/main/src/languages/json-language.js) as an example of a basic `Language` class.
0 commit comments