Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add eslint-plugin-jsonc (#160)
Co-authored-by: Julien <julien@ripouteau.com>
- Loading branch information
1 parent
d2bf20f
commit 423dbb7
Showing
52 changed files
with
1,621 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Eslint Jsonc extensions. | ||
* | ||
* @see [Eslint Jsonc extensions](https://github.com/ota-meshi/eslint-plugin-jsonc#configuration) | ||
*/ | ||
export type JsoncExtensions = | ||
| 'plugin:jsdoc/base' | ||
| 'plugin:jsdoc/recommended' | ||
| 'plugin:jsonc/recommended-with-json' | ||
| 'plugin:jsonc/recommended-with-jsonc' | ||
| 'plugin:jsonc/recommended-with-json5' | ||
| 'plugin:jsonc/prettier' | ||
| 'plugin:jsonc/all'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export type ArrayBracketNewlineOption = | ||
| ('always' | 'never' | 'consistent') | ||
| { | ||
multiline?: boolean; | ||
minItems?: number | null; | ||
}; | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type ArrayBracketNewlineOptions = [ArrayBracketNewlineOption?]; | ||
|
||
/** | ||
* Enforce line breaks after opening and before closing array brackets. | ||
* | ||
* @see [array-bracket-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-newline.html) | ||
*/ | ||
export type ArrayBracketNewlineRuleConfig = | ||
RuleConfig<ArrayBracketNewlineOptions>; | ||
|
||
/** | ||
* Enforce line breaks after opening and before closing array brackets. | ||
* | ||
* @see [array-bracket-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-newline.html) | ||
*/ | ||
export interface ArrayBracketNewlineRule { | ||
/** | ||
* Enforce line breaks after opening and before closing array brackets. | ||
* | ||
* @see [array-bracket-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-newline.html) | ||
*/ | ||
'jsonc/array-bracket-newline': ArrayBracketNewlineRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Config. | ||
*/ | ||
export interface ArrayBracketSpacingConfig { | ||
singleValue?: boolean; | ||
objectsInArrays?: boolean; | ||
arraysInArrays?: boolean; | ||
} | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export type ArrayBracketSpacingOption = 'always' | 'never'; | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type ArrayBracketSpacingOptions = [ | ||
ArrayBracketSpacingOption?, | ||
ArrayBracketSpacingConfig?, | ||
]; | ||
|
||
/** | ||
* Disallow or enforce spaces inside of brackets. | ||
* | ||
* @see [array-bracket-spacing](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-spacing.html) | ||
*/ | ||
export type ArrayBracketSpacingRuleConfig = | ||
RuleConfig<ArrayBracketSpacingOptions>; | ||
|
||
/** | ||
* Disallow or enforce spaces inside of brackets. | ||
* | ||
* @see [array-bracket-spacing](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-spacing.html) | ||
*/ | ||
export interface ArrayBracketSpacingRule { | ||
/** | ||
* Disallow or enforce spaces inside of brackets. | ||
* | ||
* @see [array-bracket-spacing](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-spacing.html) | ||
*/ | ||
'jsonc/array-bracket-spacing': ArrayBracketSpacingRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export type ArrayElementNewlineOption = | ||
| [] | ||
| [ | ||
| BasicConfig | ||
| { | ||
ArrayExpression?: BasicConfig; | ||
ArrayPattern?: BasicConfig; | ||
}, | ||
]; | ||
export type BasicConfig = | ||
| ('always' | 'never' | 'consistent') | ||
| { | ||
multiline?: boolean; | ||
minItems?: number | null; | ||
}; | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type ArrayElementNewlineOptions = ArrayElementNewlineOption; | ||
|
||
/** | ||
* Enforce line breaks between array elements. | ||
* | ||
* @see [array-element-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-element-newline.html) | ||
*/ | ||
export type ArrayElementNewlineRuleConfig = | ||
RuleConfig<ArrayElementNewlineOptions>; | ||
|
||
/** | ||
* Enforce line breaks between array elements. | ||
* | ||
* @see [array-element-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-element-newline.html) | ||
*/ | ||
export interface ArrayElementNewlineRule { | ||
/** | ||
* Enforce line breaks between array elements. | ||
* | ||
* @see [array-element-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-element-newline.html) | ||
*/ | ||
'jsonc/array-element-newline': ArrayElementNewlineRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Apply jsonc rules similar to your configured ESLint core rules. | ||
* | ||
* @see [auto](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/auto.html) | ||
*/ | ||
export type AutoRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* Apply jsonc rules similar to your configured ESLint core rules. | ||
* | ||
* @see [auto](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/auto.html) | ||
*/ | ||
export interface AutoRule { | ||
/** | ||
* Apply jsonc rules similar to your configured ESLint core rules. | ||
* | ||
* @see [auto](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/auto.html) | ||
*/ | ||
'jsonc/auto': AutoRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export type CommaDangleOption = | ||
| [] | ||
| [ | ||
| Value | ||
| { | ||
arrays?: ValueWithIgnore; | ||
objects?: ValueWithIgnore; | ||
imports?: ValueWithIgnore; | ||
exports?: ValueWithIgnore; | ||
functions?: ValueWithIgnore; | ||
}, | ||
]; | ||
export type Value = 'always-multiline' | 'always' | 'never' | 'only-multiline'; | ||
export type ValueWithIgnore = | ||
| 'always-multiline' | ||
| 'always' | ||
| 'ignore' | ||
| 'never' | ||
| 'only-multiline'; | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type CommaDangleOptions = CommaDangleOption; | ||
|
||
/** | ||
* Require or disallow trailing commas. | ||
* | ||
* @see [comma-dangle](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-dangle.html) | ||
*/ | ||
export type CommaDangleRuleConfig = RuleConfig<CommaDangleOptions>; | ||
|
||
/** | ||
* Require or disallow trailing commas. | ||
* | ||
* @see [comma-dangle](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-dangle.html) | ||
*/ | ||
export interface CommaDangleRule { | ||
/** | ||
* Require or disallow trailing commas. | ||
* | ||
* @see [comma-dangle](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-dangle.html) | ||
*/ | ||
'jsonc/comma-dangle': CommaDangleRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Config. | ||
*/ | ||
export interface CommaStyleConfig { | ||
exceptions?: { | ||
[k: string]: boolean; | ||
}; | ||
} | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export type CommaStyleOption = 'first' | 'last'; | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type CommaStyleOptions = [CommaStyleOption?, CommaStyleConfig?]; | ||
|
||
/** | ||
* Enforce consistent comma style. | ||
* | ||
* @see [comma-style](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-style.html) | ||
*/ | ||
export type CommaStyleRuleConfig = RuleConfig<CommaStyleOptions>; | ||
|
||
/** | ||
* Enforce consistent comma style. | ||
* | ||
* @see [comma-style](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-style.html) | ||
*/ | ||
export interface CommaStyleRule { | ||
/** | ||
* Enforce consistent comma style. | ||
* | ||
* @see [comma-style](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-style.html) | ||
*/ | ||
'jsonc/comma-style': CommaStyleRuleConfig; | ||
} |
Oops, something went wrong.