Commit 40eb4be
Add ESLint language plugin support (#532)
* Initial plan
* Add ESLint language plugin support with YAMLLanguage implementation
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Add changeset for ESLint language plugin support
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Fix getTokensBetween signature for better type consistency
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Update add-language-plugin-support.md
* Add test cases for language plugin support
- Add tests/src/language/directive-comments.ts for ESLint directive comment functionality
- Add tests/src/language/yaml-source-code.ts for YAMLSourceCode class methods
- Tests cover eslint-disable, eslint-enable, eslint-disable-line, eslint-disable-next-line
- Tests cover inline configuration comments
- Tests cover YAMLSourceCode token and comment retrieval methods
- All 45 new tests passing, total 5153 tests pass
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Add token-store and core-rules compatibility tests
- Add tests/src/language/token-store.ts for comprehensive TokenStore testing
- Add tests/src/language/yaml-source-code-with-core-rules.ts for ESLint core rules compatibility
- TokenStore tests cover all methods: getFirstToken, getLastToken, getTokenBefore/After, getTokens, getTokensBetween, getComments
- Core rules test ensures all ESLint built-in rules don't crash with yml/yaml language
- 320 new tests added (28 TokenStore + 292 core rules tests)
- Total: 5,473 tests passing
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Fix linting errors - remove trailing whitespace
Fixed prettier/prettier errors in yaml-source-code.ts test file by removing trailing whitespace from 3 lines.
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Update add-language-plugin-support.md
* Refactor token-store tests to remove getPair helper
Removed getPair helper function and added explicit assertions to each test for navigating the AST structure (ast.body[0], doc.content, content.pairs). This makes tests more explicit and clear about what they're testing, as suggested in code review.
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Add language plugin documentation to README and user guide
Added "Languages" section to both README.md and docs/user-guide/index.md documenting the yml/yaml language identifier and how to use it in ESLint configurations. Follows the same pattern as eslint-plugin-toml documentation.
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Fix test names to accurately reflect single-rule testing
Updated test names in directive-comments.ts:
- Changed "should disable multiple rules separated by commas" to "should disable a specific rule with eslint-disable-next-line"
- Changed "should configure multiple rules in one comment" to "should configure a rule with inline config comment"
These tests only test single rules, so the names now accurately reflect their behavior.
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Update tests to actually test multiple rules as originally intended
Restored original test names and updated test implementations:
- "should disable multiple rules separated by commas" now tests disabling both yml/no-empty-key and yml/no-empty-mapping-value with eslint-disable-next-line
- "should configure multiple rules in one comment" now tests configuring both rules in a single inline config comment
Tests now match their descriptions and validate multi-rule directive functionality.
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>1 parent 5af8943 commit 40eb4be
File tree
13 files changed
+2513
-12
lines changed- .changeset
- docs/user-guide
- src
- language
- tests/src/language
13 files changed
+2513
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
153 | 178 | | |
154 | 179 | | |
155 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
107 | 132 | | |
108 | 133 | | |
109 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
| 31 | + | |
28 | 32 | | |
29 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
30 | 36 | | |
31 | | - | |
32 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments