eslint-plugin-sort-decorators 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.badges/code/coverage-branches.svg +1 -0
- package/.badges/code/coverage-functions.svg +1 -0
- package/.badges/code/coverage-jest coverage.svg +1 -0
- package/.badges/code/coverage-lines.svg +1 -0
- package/.badges/code/coverage-statements.svg +1 -0
- package/.badges/code/coverage.svg +1 -0
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/docs/rules/sort-on-accessors.md +114 -0
- package/docs/rules/sort-on-classes.md +106 -0
- package/docs/rules/sort-on-methods.md +114 -0
- package/docs/rules/sort-on-parameters.md +116 -0
- package/docs/rules/sort-on-properties.md +114 -0
- package/package.json +88 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="131" height="20" role="img" aria-label="branches: 90.54%"><title>branches: 90.54%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="131" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="78" height="20" fill="#555"/><rect x="78" width="53" height="20" fill="#4c1"/><rect width="131" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZXNtb2tlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+SmVzdDwvdGl0bGU+PHBhdGggZD0iTTIyLjI1MSAxMS44MmEzLjExNyAzLjExNyAwI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QuMTM5LjI4NC0uMTA0YzEuMjE2LS40MzEgMi4zNDItMS4xMzMgMy4zMzYtMi4wNzFhOS4zMzQgOS4zMzQgMCAwIDAgMS40NDUtMS43MTZjLjE2LjAyNy4zMi4wMzQuNDguMDM0YTMuMTE3IDMuMTE3IDAgMCAwIDMuMDA4LTIuMzI3aDEuMTY3YTMuMTA5IDMuMTA5IDAgMCAwIDMuMDEgMi4zMjdjLjU3NiAwIDEuMTEtLjE2IDEuNTctLjQzLjE4LjUyLjIzNiAxLjA2My4xMzkgMS42MDV6Ii8+PC9zdmc+"/><text aria-hidden="true" x="485" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">branches</text><text x="485" y="140" transform="scale(.1)" fill="#fff" textLength="510">branches</text><text aria-hidden="true" x="1035" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">90.54%</text><text x="1035" y="140" transform="scale(.1)" fill="#fff" textLength="430">90.54%</text></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="121" height="20" role="img" aria-label="functions: 100%"><title>functions: 100%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="121" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="78" height="20" fill="#555"/><rect x="78" width="43" height="20" fill="#4c1"/><rect width="121" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZXNtb2tlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48d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EyLjA5OC40NzkuMTI2LS4yNjQgMS40NzMuNDg2IDIuOTk0IDEuOTQ2IDMuNzQ1bC4yNjQuMTM5LjI4NC0uMTA0YzEuMjE2LS40MzEgMi4zNDItMS4xMzMgMy4zMzYtMi4wNzFhOS4zMzQgOS4zMzQgMCAwIDAgMS40NDUtMS43MTZjLjE2LjAyNy4zMi4wMzQuNDguMDM0YTMuMTE3IDMuMTE3IDAgMCAwIDMuMDA4LTIuMzI3aDEuMTY3YTMuMTA5IDMuMTA5IDAgMCAwIDMuMDEgMi4zMjdjLjU3NiAwIDEuMTEtLjE2IDEuNTctLjQzLjE4LjUyLjIzNiAxLjA2My4xMzkgMS42MDV6Ii8+PC9zdmc+"/><text aria-hidden="true" x="485" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">functions</text><text x="485" y="140" transform="scale(.1)" fill="#fff" textLength="510">functions</text><text aria-hidden="true" x="985" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">100%</text><text x="985" y="140" transform="scale(.1)" fill="#fff" textLength="330">100%</text></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="155" height="20" role="img" aria-label="jest coverage: 97.64%"><title>jest coverage: 97.64%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="155" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="102" height="20" fill="#555"/><rect x="102" width="53" height="20" fill="#4c1"/><rect width="155" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZXNtb2tlIiByb2xlPSJpbWciIHZ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xLjk2NiAxLjA3Ny0yLjg3Ny4wMjgtLjA1NS4wNDktLjEwNC4wNzctLjE2LjE1Mi4wNTYuMzEyLjA5OC40NzkuMTI2LS4yNjQgMS40NzMuNDg2IDIuOTk0IDEuOTQ2IDMuNzQ1bC4yNjQuMTM5LjI4NC0uMTA0YzEuMjE2LS40MzEgMi4zNDItMS4xMzMgMy4zMzYtMi4wNzFhOS4zMzQgOS4zMzQgMCAwIDAgMS40NDUtMS43MTZjLjE2LjAyNy4zMi4wMzQuNDguMDM0YTMuMTE3IDMuMTE3IDAgMCAwIDMuMDA4LTIuMzI3aDEuMTY3YTMuMTA5IDMuMTA5IDAgMCAwIDMuMDEgMi4zMjdjLjU3NiAwIDEuMTEtLjE2IDEuNTctLjQzLjE4LjUyLjIzNiAxLjA2My4xMzkgMS42MDV6Ii8+PC9zdmc+"/><text aria-hidden="true" x="605" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="750">jest coverage</text><text x="605" y="140" transform="scale(.1)" fill="#fff" textLength="750">jest coverage</text><text aria-hidden="true" x="1275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">97.64%</text><text x="1275" y="140" transform="scale(.1)" fill="#fff" textLength="430">97.64%</text></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="95" height="20" role="img" aria-label="lines: 100%"><title>lines: 100%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="95" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="52" height="20" fill="#555"/><rect x="52" width="43" height="20" fill="#4c1"/><rect width="95" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><image x="5" y="3" width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LS42ODhjLTEuNTI5LTEuMDU2LTEuNDUzLTMuMDM2LTEuMjcyLTQuMTIuMTY3LTEuMDE1LjYzMi0xLjk2NiAxLjA3Ny0yLjg3Ny4wMjgtLjA1NS4wNDktLjEwNC4wNzctLjE2LjE1Mi4wNTYuMzEyLjA5OC40NzkuMTI2LS4yNjQgMS40NzMuNDg2IDIuOTk0IDEuOTQ2IDMuNzQ1bC4yNjQuMTM5LjI4NC0uMTA0YzEuMjE2LS40MzEgMi4zNDItMS4xMzMgMy4zMzYtMi4wNzFhOS4zMzQgOS4zMzQgMCAwIDAgMS40NDUtMS43MTZjLjE2LjAyNy4zMi4wMzQuNDguMDM0YTMuMTE3IDMuMTE3IDAgMCAwIDMuMDA4LTIuMzI3aDEuMTY3YTMuMTA5IDMuMTA5IDAgMCAwIDMuMDEgMi4zMjdjLjU3NiAwIDEuMTEtLjE2IDEuNTctLjQzLjE4LjUyLjIzNiAxLjA2My4xMzkgMS42MDV6Ii8+PC9zdmc+"/><text aria-hidden="true" x="355" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">lines</text><text x="355" y="140" transform="scale(.1)" fill="#fff" textLength="250">lines</text><text aria-hidden="true" x="725" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">100%</text><text x="725" y="140" transform="scale(.1)" fill="#fff" textLength="330">100%</text></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="131" height="20" role="img" aria-label="statements: 100%"><title>statements: 100%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="131" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="88" height="20" fill="#555"/><rect x="88" width="43" height="20" fill="#4c1"/><rect width="131" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZXNtb2tlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+SmVzdDwvdGl0bGU+PHBhdGggZD0iTTIyLjI1MSAxMS44MmEzLjExNyAzLjExNyAwIDAgMC0yLjMyOC0zLjAxTDIyLjkxMSAwSDguMTA0TDExLjEgOC44MzhhMy4xMTYgMy4xMTYgMCAwIDAtMi4yNDQgMi45ODhjMCAxLjA0My41MiAxLjk2NyAxLjMxMyAyLjUzNmE4LjI3OSA4LjI3OSAwIDAgMS0xLjA4NCAxLjI0NCA4LjE0IDguMTQgMCAwIDEtMi41NSAxLjY0N2MtLjgzNC0uNTYzLTEuMTk1LTEuNTU2LS44NjktMi40NDZhMy4xMSAzLjExIDAgMCAwLS45MS02LjA4IDMuMTE3IDMuMTE3IDAgMCAwLTMuMTEzIDMuMTEzYzAgLjg0OC4zNDcgMS42MjYuOTAzIDIuMTgyLS4wNDguMDk3LS4wOTcuMTk1LS4xNDYuMjk5LS40NjUuOTU5LS45OTMgMi4wNDMtMS4xOTUgMy4yNTktLjQwMyAyLjQzMi4yNTcgNC4zODQgMS44NDkgNS40ODlBNS4wOTMgNS4wOTMgMCAwIDAgNS45OTkgMjRjMS44MjcgMCAzLjY4Mi0uOTE3IDUuNDc1LTEuODA3IDEuMjc5LS42MzIgMi41OTktMS4yOTIgMy44OTgtMS42MTIuNDgtLjExOC45OC0uMTg3IDEuNTA4LS4yNjQgMS4wNy0uMTUzIDIuMTc1LS4zMTIgMy4xNjgtLjg5YTQuNDgyIDQuNDgyIDAgMCAwIDIuMTgyLTMuMDkxYy4xNzQtLjk5NCAwLTEuOTk0LS40NDQtMi44Ny4yOTgtLjQ4LjQ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LTMuMzUgMS42Ni00Ljg1NyAxLjY2YTMuNjQ1IDMuNjQ1IDAgMCAxLTIuMTU0LS42ODhjLTEuNTI5LTEuMDU2LTEuNDUzLTMuMDM2LTEuMjcyLTQuMTIuMTY3LTEuMDE1LjYzMi0xLjk2NiAxLjA3Ny0yLjg3Ny4wMjgtLjA1NS4wNDktLjEwNC4wNzctLjE2LjE1Mi4wNTYuMzEyLjA5OC40NzkuMTI2LS4yNjQgMS40NzMuNDg2IDIuOTk0IDEuOTQ2IDMuNzQ1bC4yNjQuMTM5LjI4NC0uMTA0YzEuMjE2LS40MzEgMi4zNDItMS4xMzMgMy4zMzYtMi4wNzFhOS4zMzQgOS4zMzQgMCAwIDAgMS40NDUtMS43MTZjLjE2LjAyNy4zMi4wMzQuNDguMDM0YTMuMTE3IDMuMTE3IDAgMCAwIDMuMDA4LTIuMzI3aDEuMTY3YTMuMTA5IDMuMTA5IDAgMCAwIDMuMDEgMi4zMjdjLjU3NiAwIDEuMTEtLjE2IDEuNTctLjQzLjE4LjUyLjIzNiAxLjA2My4xMzkgMS42MDV6Ii8+PC9zdmc+"/><text aria-hidden="true" x="535" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">statements</text><text x="535" y="140" transform="scale(.1)" fill="#fff" textLength="610">statements</text><text aria-hidden="true" x="1085" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">100%</text><text x="1085" y="140" transform="scale(.1)" fill="#fff" textLength="330">100%</text></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="155" height="20" role="img" aria-label="jest coverage: 97.64%"><title>jest coverage: 97.64%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="155" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="102" height="20" fill="#555"/><rect x="102" width="53" height="20" fill="#4c1"/><rect width="155" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZXNtb2tlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+SmVzdDwvdGl0bGU+PHBhdGggZD0iTTIyLjI1MSAxMS44MmEzLjExNyAzLjExNyAwIDAgMC0yLjMyOC0zLjAxTDIyLjkxMSAwSDguMTA0TDExLjEgOC44MzhhMy4xMTYgMy4xMTYgMCAwIDAtMi4yNDQgMi45ODhjMCAxLjA0My41MiAxLjk2NyAxLjMxMyAyLjUzNmE4LjI3OSA4LjI3OSAwIDAgMS0xLjA4NCAxLjI0NCA4LjE0IDguMTQgMCAwIDEtMi41NSAxLjY0N2MtLjgzNC0uNTYzLTEuMTk1LTEuNTU2LS44NjktMi40NDZhMy4xMSAzLjExIDAgMCAwLS45MS02LjA4IDMuMTE3IDMuMTE3IDAgMCAwLTMuMTEzIDMuMTEzYzAgLjg0OC4zNDcgMS42MjYuOTAzIDIuMTgyLS4wNDguMDk3LS4wOTcuMTk1LS4xNDYuMjk5LS40NjUuOTU5LS45OTMgMi4wNDMtMS4xOTUgMy4yNTktLjQwMyAyLjQzMi4yNTcgNC4zODQgMS44NDkgNS40ODlBNS4wOTMgNS4wOTMgMCAwIDAgNS45OTkgMjRjMS44MjcgMCAzLjY4Mi0uOTE3IDUuNDc1LTEuODA3IDEuMjc5LS42MzIgMi41OTktMS4yOTIgMy44OTgtMS42MTIuNDgtLjExOC45OC0uMTg3IDEuNTA4LS4yNjQgMS4wNy0uMTUzIDIuMTc1LS4zMTIgMy4xNjgtLjg5YTQuNDgyIDQuNDgyID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yOSAwIDAgMC0xLjY0LjI5MWMtMS40NDUuMzU1LTIuODM0IDEuMDUtNC4xODIgMS43MTctMS43MjQuODU0LTMuMzUgMS42Ni00Ljg1NyAxLjY2YTMuNjQ1IDMuNjQ1IDAgMCAxLTIuMTU0LS42ODhjLTEuNTI5LTEuMDU2LTEuNDUzLTMuMDM2LTEuMjcyLTQuMTIuMTY3LTEuMDE1LjYzMi0xLjk2NiAxLjA3Ny0yLjg3Ny4wMjgtLjA1NS4wNDktLjEwNC4wNzctLjE2LjE1Mi4wNTYuMzEyLjA5OC40NzkuMTI2LS4yNjQgMS40NzMuNDg2IDIuOTk0IDEuOTQ2IDMuNzQ1bC4yNjQuMTM5LjI4NC0uMTA0YzEuMjE2LS40MzEgMi4zNDItMS4xMzMgMy4zMzYtMi4wNzFhOS4zMzQgOS4zMzQgMCAwIDAgMS40NDUtMS43MTZjLjE2LjAyNy4zMi4wMzQuNDguMDM0YTMuMTE3IDMuMTE3IDAgMCAwIDMuMDA4LTIuMzI3aDEuMTY3YTMuMTA5IDMuMTA5IDAgMCAwIDMuMDEgMi4zMjdjLjU3NiAwIDEuMTEtLjE2IDEuNTctLjQzLjE4LjUyLjIzNiAxLjA2My4xMzkgMS42MDV6Ii8+PC9zdmc+"/><text aria-hidden="true" x="605" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="750">jest coverage</text><text x="605" y="140" transform="scale(.1)" fill="#fff" textLength="750">jest coverage</text><text aria-hidden="true" x="1275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">97.64%</text><text x="1275" y="140" transform="scale(.1)" fill="#fff" textLength="430">97.64%</text></g></svg>
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 HugoMendes98
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# eslint-plugin-sort-decorators
|
|
2
|
+
|
|
3
|
+
[](https://github.com/heap-code/eslint-plugin-sort-decorators/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/eslint-plugin-sort-decorators)
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
An ESLint plugin to sort decorators
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
First, the peer dependencies must be installed:
|
|
12
|
+
|
|
13
|
+
- [eslint](http://eslint.org)
|
|
14
|
+
- [typescript](http://www.typescriptlang.org/)
|
|
15
|
+
- [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser/)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm i --save-dev typescript eslint @typescript-eslint/parser
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Next, install `eslint-plugin-sort-decorators`:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm i --save-dev eslint-plugin-sort-decorators
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
As this plugin only works with _typescript_,
|
|
30
|
+
the parser must be set in a [.eslintrc](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file-formats)
|
|
31
|
+
file:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"parser": "@typescript-eslint/parser"
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The plugin can then be activated by adding `sort-decorators` to the `plugins` property:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"plugins": ["sort-decorators"]
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The different rules can be defined as follows:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"rules": {
|
|
52
|
+
"sort-decorators/sort-on-classes": "error"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> All these configuration can be done on a `override` section:
|
|
58
|
+
> <https://eslint.org/docs/latest/use/configure/configuration-files#how-do-overrides-work>
|
|
59
|
+
|
|
60
|
+
## Rules
|
|
61
|
+
|
|
62
|
+
<!-- begin auto-generated rules list -->
|
|
63
|
+
|
|
64
|
+
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).
|
|
65
|
+
|
|
66
|
+
| Name | Description | 🔧 |
|
|
67
|
+
| :----------------------------------------------------- | :-------------------------------------- | :- |
|
|
68
|
+
| [sort-on-accessors](docs/rules/sort-on-accessors.md) | Enforces order of accessors decorators | 🔧 |
|
|
69
|
+
| [sort-on-classes](docs/rules/sort-on-classes.md) | Enforces order of class decorators | 🔧 |
|
|
70
|
+
| [sort-on-methods](docs/rules/sort-on-methods.md) | Enforces order of methods decorators | 🔧 |
|
|
71
|
+
| [sort-on-parameters](docs/rules/sort-on-parameters.md) | Enforces order of parameters decorators | 🔧 |
|
|
72
|
+
| [sort-on-properties](docs/rules/sort-on-properties.md) | Enforces order of properties decorators | 🔧 |
|
|
73
|
+
|
|
74
|
+
<!-- end auto-generated rules list -->
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(r,e,t){if(e in r){Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true})}else{r[e]=t}return r}function n(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function o(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var i=false;var a,c;try{for(t=t.call(r);!(o=(a=t.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(r){i=true;c=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(i)throw c}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}o.forEach(function(e){t(r,e,n[e])})}return r}function c(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);if(e){n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})}t.push.apply(t,n)}return t}function u(r,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(r,Object.getOwnPropertyDescriptors(e))}else{c(Object(e)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})}return r}function s(r,t){return e(r)||o(r,t)||d(r,t)||i()}function f(r){return e(r)||n(r)||d(r)||i()}function d(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}var l=require("@typescript-eslint/types");var v=require("@typescript-eslint/utils");var p={$schema:"http://json-schema.org/draft-07/schema#",additionalProperties:!1,properties:{autoFix:{default:!1,description:"Automatically fix the order.\nWhen set to `true`, only one error is reported and the whole set of decorators is fixed.",type:"boolean"},caseSensitive:{default:!0,description:"If true, enforce properties to be in case-sensitive order.",type:"boolean"},direction:{description:"Specify the direction of the ordering.",enum:["asc","desc"],type:"string"}},type:"object"};var y=v.ESLintUtils.RuleCreator(function(r){return r});function m(r){return y(u(a({},r),{defaultOptions:[{autoFix:!1,caseSensitive:!0,direction:"asc"}],meta:u(a({schema:[p]},r.meta),{docs:u(a({requiresTypeChecking:!1},r.meta.docs),{recommended:"warn"}),fixable:"code",messages:{"incorrect-order":"Expected decorators to be in sorted order. `@{{ after }}` should be before `@{{ previous }}`."},type:"layout"})}))}function b(r){var e=function(r){switch(r.type){case v.AST_NODE_TYPES.CallExpression:return e(r.callee);case v.AST_NODE_TYPES.Identifier:return r.name}throw new Error("Not a valid decorator.")};return e(r.expression)}function h(r,e,t){var n=t.autoFix,o=t.caseSensitive,i=t.direction,a=function(r){var e=b(r);return o?e:e.toLowerCase()},c=function(r,e){var t;return t=s(i==="desc"?[e,r]:[r,e],2),r=t[0],e=t[1],t,r===e?0:r<e?-1:1},u=e.map(function(r){return{name:a(r),node:r}}),d=function(e,t){var n=r.getSourceCode(),o=n.getText(),i=t.slice().sort(function(r,e){var t=r.name,n=e.name;return c(t,n)}).map(function(r){var e=r.node;return e}),a=i.map(function(r,e){var a=e===i.length-1?"":o.slice(t[e].node.range[1],t[e+1].node.range[0]);return n.getText(r)+a});return e.replaceTextRange([t[0].node.range[0],t[t.length-1].node.range[1]],a.join(""))},l=function(e){if(e.length<=1)return;var t=f(e),o=t[0],i=o.name,a=t.slice(1);var u=true,s=false,v=undefined;try{for(var p=a[Symbol.iterator](),y;!(u=(y=p.next()).done);u=true){var m=y.value,b=m.name,h=m.node;if(c(i,b)>0){r.report({data:{after:b,previous:i},fix:n?function(r){return d(r,e)}:void 0,messageId:"incorrect-order",node:h});return}}}catch(r){s=true;v=r}finally{try{if(!u&&p.return!=null){p.return()}}finally{if(s){throw v}}}n&&l(e.slice(1))};l(u)}var g="sort-on-accessors",O=m({create:function(r,e){var t=s(e,1),n=t[0];var o=n.autoFix,i=function(r){var e;var t=r.parent;return((e=t)===null||e===void 0?void 0:e.type)===l.AST_NODE_TYPES.MethodDefinition&&t.kind==="get"?t:!1};return o?{Decorator:function e(e){var t=i(e);if(!t)return;var o=t.decorators;o[0]===e&&h(r,o,n)}}:{Decorator:function e(e){var t=i(e);if(!t)return;var o=t.decorators,a=o.findIndex(function(r){return r===e});h(r,o.slice(a),n)}}},meta:{docs:{description:"Enforces order of accessors decorators"}},name:g});var S="sort-on-classes",E=m({create:function(r,e){var t=s(e,1),n=t[0];var o=n.autoFix;return o?{ClassDeclaration:function e(e){var t=e.decorators;h(r,t!==null&&t!==void 0?t:[],n)}}:{Decorator:function e(e){var t;var o=e.parent;if(((t=o)===null||t===void 0?void 0:t.type)!==l.AST_NODE_TYPES.ClassDeclaration)return;var i=o.decorators,a=i.findIndex(function(r){return r===e});h(r,i.slice(a),n)}}},meta:{docs:{description:"Enforces order of class decorators"}},name:S});var x="sort-on-methods",D=m({create:function(r,e){var t=s(e,1),n=t[0];var o=n.autoFix;return o?{MethodDefinition:function e(e){var t=e.decorators,o=e.kind;o==="method"&&h(r,t,n)}}:{Decorator:function e(e){var t;var o=e.parent;if(((t=o)===null||t===void 0?void 0:t.type)!==l.AST_NODE_TYPES.MethodDefinition)return;var i=o.decorators,a=i.findIndex(function(r){return r===e});h(r,i.slice(a),n)}}},meta:{docs:{description:"Enforces order of methods decorators"}},name:x});var P="sort-on-parameters",j=m({create:function(r,e){var t=s(e,1),n=t[0];var o=n.autoFix,i=function(r){var e,t;var n=r.parent;return((e=n)===null||e===void 0?void 0:e.type)===l.AST_NODE_TYPES.Identifier&&((t=n.parent)===null||t===void 0?void 0:t.type)===l.AST_NODE_TYPES.FunctionExpression?n:!1};return o?{Decorator:function e(e){var t=i(e);if(!t)return;var o=t.decorators;o[0]===e&&h(r,o,n)}}:{Decorator:function e(e){var t=i(e);if(!t)return;var o=t.decorators,a=o.findIndex(function(r){return r===e});h(r,o.slice(a),n)}}},meta:{docs:{description:"Enforces order of parameters decorators"}},name:P});var w="sort-on-properties",T=m({create:function(r,e){var t=s(e,1),n=t[0];var o=n.autoFix;return o?{PropertyDefinition:function e(e){var t=e.decorators;h(r,t!==null&&t!==void 0?t:[],n)}}:{Decorator:function e(e){var t;var o=e.parent;if(((t=o)===null||t===void 0?void 0:t.type)!==l.AST_NODE_TYPES.PropertyDefinition)return;var i=o.decorators,a=i.findIndex(function(r){return r===e});h(r,i.slice(a),n)}}},meta:{docs:{description:"Enforces order of properties decorators"}},name:w});var A;var _={rules:(A={},t(A,g,O),t(A,S,E),t(A,x,D),t(A,P,j),t(A,w,T),A)};module.exports=_;//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rules/sort-on-accessors.ts","../src/lib/sort-rule/sort-rule.ts","../src/lib/sort-rule/sort-rule.options.schema.json","../src/lib/decorator/get-decorator-name.ts","../src/lib/sort-rule/sort-rule.listener.ts","../src/rules/sort-on-classes.ts","../src/rules/sort-on-methods.ts","../src/rules/sort-on-parameters.ts","../src/rules/sort-on-properties.ts","../src/index.ts"],"names":["AST_NODE_TYPES","ESLintUtils","sort_rule_options_schema_default","sortRuleCreator","name","createSortRule","rule","getDecoratorName","decorator","getName","expression","sortRuleListener","context","decorators","options","autoFix","caseSensitive","direction","compare","a","b","decoratorsWithName","createFix","fixer","sourceCode","sourceText","sorted","node","newText","child","i","textAfter","sortRule","currentName","remaining","SORT_ON_ACCESSORS_NAME","sortOnAccessors","optionsWithDefault","getDecorated","parent","nodeIndex","SORT_ON_CLASSES_NAME","sortOnClasses","SORT_ON_METHODS_NAME","sortOnMethods","kind","SORT_ON_PARAMETERS_NAME","sortOnParameters","SORT_ON_PROPERTIES_NAME","sortOnProperties","src_default"],"mappings":"AAAA,OAAS,kBAAAA,MAAsB,2BCA/B,OAAS,eAAAC,MAA6B,2BCAtC,IAAAC,EAAA,CACC,QAAW,0CACX,qBAAwB,GACxB,WAAc,CACb,QAAW,CACV,QAAW,GACX,YAAe,yHACf,KAAQ,SACT,EACA,cAAiB,CAChB,QAAW,GACX,YAAe,6DACf,KAAQ,SACT,EACA,UAAa,CACZ,YAAe,yCACf,KAAQ,CAAC,MAAO,MAAM,EACtB,KAAQ,QACT,CACD,EACA,KAAQ,QACT,EDGA,IAAMC,EAAkBF,EAAY,YAAYG,GAAQA,CAAI,EAMrD,SAASC,EAAeC,EAA+B,CAC7D,OAAOH,EAAgB,CACtB,GAAGG,EACH,eAAgB,CAAC,CAAE,QAAS,GAAO,cAAe,GAAM,UAAW,KAAM,CAAC,EAC1E,KAAM,CACL,OAAQ,CAACJ,CAAM,EAEf,GAAGI,EAAK,KACR,KAAM,CACL,qBAAsB,GAEtB,GAAGA,EAAK,KAAK,KACb,YAAa,MACd,EACA,QAAS,OACT,SAAU,CACT,kBACC,+FACF,EACA,KAAM,QACP,CACD,CAAC,CACF,CEnDA,OAAS,kBAAAN,MAAgC,2BAMlC,SAASO,EAAiBC,EAAuC,CACvE,IAAMC,EAAWC,GAA+C,CAC/D,OAAQA,EAAW,KAAM,CACxB,KAAK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A,EACA,CACA,UAAUV,EAAM,CACf,GAAM,CAAE,OAAAY,CAAO,EAAIZ,EACnB,GAAIY,GAAQ,OAASvC,EAAe,mBAEnC,OAID,IAAMa,EAAa0B,EAAO,WAGpBC,EAAY3B,EAAW,UAAUL,GAAaA,IAAcmB,CAAI,EACtEhB,EAAiBC,EAASC,EAAW,MAAM2B,CAAS,EAAGH,CAAkB,CAC1E,CACA,CACJ,EACA,KAAM,CACL,KAAM,CACL,YAAa,yCACd,CACD,EACA,KAAMW,CACP,CAAC,ECxBD,IAAOE,GAAQ,CACd,MAAO,CACN,CAACf,CAAsB,EAAGC,EAC1B,CAACK,CAAoB,EAAGC,EACxB,CAACC,CAAoB,EAAGC,EACxB,CAACE,CAAuB,EAAGC,EAC3B,CAACC,CAAuB,EAAGC,CAC5B,CACD","sourcesContent":["import { AST_NODE_TYPES } from \"@typescript-eslint/types\";\nimport { TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createSortRule, sortRuleListener } from \"../lib/sort-rule\";\n\nexport const SORT_ON_ACCESSORS_NAME = \"sort-on-accessors\";\n\nexport const sortOnAccessors = createSortRule({\n\tcreate: (context, [optionsWithDefault]) => {\n\t\tconst { autoFix } = optionsWithDefault;\n\n\t\tconst getDecorated = (node: TSESTree.Decorator) => {\n\t\t\tconst { parent } = node;\n\n\t\t\t// Only get the decorated node, if it is an accessor\n\t\t\tif (parent?.type === AST_NODE_TYPES.MethodDefinition && parent.kind === \"get\") {\n\t\t\t\treturn parent;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\treturn autoFix\n\t\t\t? {\n\t\t\t\t\t// TODO: a selector for the accessors only\n\t\t\t\t\tDecorator(node) {\n\t\t\t\t\t\tconst parent = getDecorated(node);\n\t\t\t\t\t\tif (!parent) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the current node comes from there\n\t\t\t\t\t\tconst decorators = parent.decorators!;\n\n\t\t\t\t\t\t// Run the listener only when on the first node\n\t\t\t\t\t\tif (decorators[0] === node) {\n\t\t\t\t\t\t\tsortRuleListener(context, decorators, optionsWithDefault);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tDecorator(node) {\n\t\t\t\t\t\tconst parent = getDecorated(node);\n\t\t\t\t\t\tif (!parent) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the current node comes from there\n\t\t\t\t\t\tconst decorators = parent.decorators!;\n\n\t\t\t\t\t\t// Get only the decorators after the current one\n\t\t\t\t\t\tconst nodeIndex = decorators.findIndex(decorator => decorator === node);\n\t\t\t\t\t\tsortRuleListener(context, decorators.slice(nodeIndex), optionsWithDefault);\n\t\t\t\t\t}\n\t\t\t };\n\t},\n\tmeta: {\n\t\tdocs: {\n\t\t\tdescription: \"Enforces order of accessors decorators\"\n\t\t}\n\t},\n\tname: SORT_ON_ACCESSORS_NAME\n});\n","import { ESLintUtils, TSESLint } from \"@typescript-eslint/utils\";\n\nimport { SortRuleMessageIds } from \"./sort-rule.message-ids\";\nimport { SortRuleOptions } from \"./sort-rule.options\";\nimport schema from \"./sort-rule.options.schema.json\";\n\ntype SortRule = ESLintUtils.RuleWithMetaAndName<\n\t[SortRuleOptions],\n\tSortRuleMessageIds,\n\tTSESLint.RuleListener\n>;\n\ninterface SortRuleMeta\n\textends Omit<SortRule[\"meta\"], \"docs\" | \"fixable\" | \"messages\" | \"schema\" | \"type\"> {\n\tdocs: Omit<SortRule[\"meta\"][\"docs\"], \"recommended\">;\n}\n\n/**\n * The information to create a \"sort-decorators\" rule\n */\nexport interface SortRuleWithMetaAndName extends Omit<SortRule, \"defaultOptions\" | \"meta\"> {\n\tmeta: SortRuleMeta;\n}\n\nconst sortRuleCreator = ESLintUtils.RuleCreator(name => name);\n\n/**\n * @param rule the parameter to create a rule\n * @returns the created rule\n */\nexport function createSortRule(rule: SortRuleWithMetaAndName) {\n\treturn sortRuleCreator({\n\t\t...rule,\n\t\tdefaultOptions: [{ autoFix: false, caseSensitive: true, direction: \"asc\" }],\n\t\tmeta: {\n\t\t\tschema: [schema],\n\n\t\t\t...rule.meta,\n\t\t\tdocs: {\n\t\t\t\trequiresTypeChecking: false,\n\n\t\t\t\t...rule.meta.docs,\n\t\t\t\trecommended: \"warn\"\n\t\t\t},\n\t\t\tfixable: \"code\",\n\t\t\tmessages: {\n\t\t\t\t\"incorrect-order\":\n\t\t\t\t\t\"Expected decorators to be in sorted order. `@{{ after }}` should be before `@{{ previous }}`.\"\n\t\t\t},\n\t\t\ttype: \"layout\"\n\t\t}\n\t});\n}\n","{\n\t\"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\"additionalProperties\": false,\n\t\"properties\": {\n\t\t\"autoFix\": {\n\t\t\t\"default\": false,\n\t\t\t\"description\": \"Automatically fix the order.\\nWhen set to `true`, only one error is reported and the whole set of decorators is fixed.\",\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"caseSensitive\": {\n\t\t\t\"default\": true,\n\t\t\t\"description\": \"If true, enforce properties to be in case-sensitive order.\",\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"direction\": {\n\t\t\t\"description\": \"Specify the direction of the ordering.\",\n\t\t\t\"enum\": [\"asc\", \"desc\"],\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"type\": \"object\"\n}\n","import { LeftHandSideExpression } from \"@typescript-eslint/types/dist/generated/ast-spec\";\nimport { AST_NODE_TYPES, TSESTree } from \"@typescript-eslint/utils\";\n\n/**\n * @param decorator the decorator node to get the name from\n * @returns the name of the given decorator\n */\nexport function getDecoratorName(decorator: TSESTree.Decorator): string {\n\tconst getName = (expression: LeftHandSideExpression): string => {\n\t\tswitch (expression.type) {\n\t\t\tcase AST_NODE_TYPES.CallExpression:\n\t\t\t\treturn getName(expression.callee);\n\n\t\t\tcase AST_NODE_TYPES.Identifier:\n\t\t\t\treturn expression.name;\n\t\t}\n\n\t\tthrow new Error(\"Not a valid decorator.\");\n\t};\n\n\treturn getName(decorator.expression);\n}\n","import { TSESTree, TSESLint } from \"@typescript-eslint/utils\";\n\nimport { SortRuleMessageIds } from \"./sort-rule.message-ids\";\nimport { SortRuleOptions } from \"./sort-rule.options\";\nimport { getDecoratorName } from \"../decorator\";\n\n/**\n * The rule listener for sorting the decorators\n *\n * @param context the context the rule is listening\n * @param decorators the decorators to test (and fix)\n * @param options the rule options\n */\nexport function sortRuleListener(\n\tcontext: TSESLint.RuleContext<SortRuleMessageIds, [SortRuleOptions]>,\n\tdecorators: TSESTree.Decorator[],\n\toptions: SortRuleOptions\n) {\n\tconst { autoFix, caseSensitive, direction } = options;\n\n\t// Get the name of a decorator given the options\n\tconst getName = (decorator: TSESTree.Decorator) => {\n\t\tconst name = getDecoratorName(decorator);\n\t\treturn caseSensitive ? name : name.toLowerCase();\n\t};\n\n\t// The comparator of names\n\tconst compare = (a: string, b: string) => {\n\t\t// swap parameters when the direction is reverted\n\t\t[a, b] = direction === \"desc\" ? [b, a] : [a, b];\n\n\t\t// `localCompare` messes with the upperCase\n\t\tif (a === b) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn a < b ? -1 : 1;\n\t};\n\n\t// Get the decorator names only once\n\tconst decoratorsWithName = decorators.map(decorator => ({\n\t\tname: getName(decorator),\n\t\tnode: decorator\n\t}));\n\n\tconst createFix = (fixer: TSESLint.RuleFixer, decorators: typeof decoratorsWithName) => {\n\t\t// Chunk of code strongly inspired from:\n\t\t// https://github.com/mthadley/eslint-plugin-sort-destructure-keys/blob/ccb0d52cb48a55668aff209e1cec4197a16bd23b/lib/rules/sort-destructure-keys.js#L158\n\n\t\tconst sourceCode = context.getSourceCode();\n\t\tconst sourceText = sourceCode.getText();\n\n\t\tconst sorted = decorators\n\t\t\t.slice()\n\t\t\t.sort(({ name: a }, { name: b }) => compare(a, b))\n\t\t\t.map(({ node }) => node);\n\n\t\tconst newText = sorted.map((child, i) => {\n\t\t\tconst textAfter =\n\t\t\t\ti === sorted.length - 1\n\t\t\t\t\t? // If it's the last item, there's no text after to append.\n\t\t\t\t\t \"\"\n\t\t\t\t\t: // Otherwise, we need to grab the text after the original node.\n\t\t\t\t\t sourceText.slice(\n\t\t\t\t\t\t\tdecorators[i].node.range[1], // End index of the current node .\n\t\t\t\t\t\t\tdecorators[i + 1].node.range[0] // Start index of the next node.\n\t\t\t\t\t );\n\n\t\t\treturn sourceCode.getText(child) + textAfter;\n\t\t});\n\n\t\treturn fixer.replaceTextRange(\n\t\t\t[decorators[0].node.range[0], decorators[decorators.length - 1].node.range[1]],\n\t\t\tnewText.join(\"\")\n\t\t);\n\t};\n\n\tconst sortRule = (decorators: typeof decoratorsWithName) => {\n\t\tif (decorators.length <= 1) {\n\t\t\t// Nothing to test when there is less than 1 decorator\n\t\t\treturn;\n\t\t}\n\n\t\tconst [{ name: currentName }, ...remaining] = decorators;\n\n\t\tfor (const { name, node } of remaining) {\n\t\t\tif (compare(currentName, name) > 0) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tafter: name,\n\t\t\t\t\t\tprevious: currentName\n\t\t\t\t\t},\n\t\t\t\t\tfix: autoFix ? fixer => createFix(fixer, decorators) : undefined,\n\t\t\t\t\tmessageId: \"incorrect-order\",\n\t\t\t\t\tnode\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (autoFix) {\n\t\t\t// On autoFix, all decorators are tested to be able to fix them all\n\t\t\tsortRule(decorators.slice(1));\n\t\t}\n\t};\n\n\tsortRule(decoratorsWithName);\n}\n","import { AST_NODE_TYPES } from \"@typescript-eslint/types\";\n\nimport { createSortRule, sortRuleListener } from \"../lib/sort-rule\";\n\nexport const SORT_ON_CLASSES_NAME = \"sort-on-classes\";\n\nexport const sortOnClasses = createSortRule({\n\tcreate: (context, [optionsWithDefault]) => {\n\t\tconst { autoFix } = optionsWithDefault;\n\n\t\treturn autoFix\n\t\t\t? {\n\t\t\t\t\tClassDeclaration({ decorators }) {\n\t\t\t\t\t\tsortRuleListener(context, decorators ?? [], optionsWithDefault);\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tDecorator(node) {\n\t\t\t\t\t\tconst { parent } = node;\n\t\t\t\t\t\tif (parent?.type !== AST_NODE_TYPES.ClassDeclaration) {\n\t\t\t\t\t\t\t// Only for classes decorators\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the current node comes from there\n\t\t\t\t\t\tconst decorators = parent.decorators!;\n\n\t\t\t\t\t\t// Get only the decorators after the current one\n\t\t\t\t\t\tconst nodeIndex = decorators.findIndex(decorator => decorator === node);\n\t\t\t\t\t\tsortRuleListener(context, decorators.slice(nodeIndex), optionsWithDefault);\n\t\t\t\t\t}\n\t\t\t };\n\t},\n\tmeta: {\n\t\tdocs: {\n\t\t\tdescription: \"Enforces order of class decorators\"\n\t\t}\n\t},\n\tname: SORT_ON_CLASSES_NAME\n});\n","import { AST_NODE_TYPES } from \"@typescript-eslint/types\";\n\nimport { createSortRule, sortRuleListener } from \"../lib/sort-rule\";\n\nexport const SORT_ON_METHODS_NAME = \"sort-on-methods\";\n\nexport const sortOnMethods = createSortRule({\n\tcreate: (context, [optionsWithDefault]) => {\n\t\tconst { autoFix } = optionsWithDefault;\n\n\t\treturn autoFix\n\t\t\t? {\n\t\t\t\t\tMethodDefinition({ decorators, kind }) {\n\t\t\t\t\t\tif (kind !== \"method\") {\n\t\t\t\t\t\t\t// Ignore if not a method\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- always defined on method definitions\n\t\t\t\t\t\tsortRuleListener(context, decorators!, optionsWithDefault);\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tDecorator(node) {\n\t\t\t\t\t\tconst { parent } = node;\n\t\t\t\t\t\tif (parent?.type !== AST_NODE_TYPES.MethodDefinition) {\n\t\t\t\t\t\t\t// Only for methods decorators\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the current node comes from there\n\t\t\t\t\t\tconst decorators = parent.decorators!;\n\n\t\t\t\t\t\t// Get only the decorators after the current one\n\t\t\t\t\t\tconst nodeIndex = decorators.findIndex(decorator => decorator === node);\n\t\t\t\t\t\tsortRuleListener(context, decorators.slice(nodeIndex), optionsWithDefault);\n\t\t\t\t\t}\n\t\t\t };\n\t},\n\tmeta: {\n\t\tdocs: {\n\t\t\tdescription: \"Enforces order of methods decorators\"\n\t\t}\n\t},\n\tname: SORT_ON_METHODS_NAME\n});\n","import { AST_NODE_TYPES } from \"@typescript-eslint/types\";\nimport { TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createSortRule, sortRuleListener } from \"../lib/sort-rule\";\n\nexport const SORT_ON_PARAMETERS_NAME = \"sort-on-parameters\";\n\nexport const sortOnParameters = createSortRule({\n\tcreate: (context, [optionsWithDefault]) => {\n\t\tconst { autoFix } = optionsWithDefault;\n\n\t\tconst getDecorated = (node: TSESTree.Decorator) => {\n\t\t\tconst { parent } = node;\n\n\t\t\t// Only get the decorated node, if it is on a method\n\t\t\tif (\n\t\t\t\tparent?.type === AST_NODE_TYPES.Identifier &&\n\t\t\t\tparent.parent?.type === AST_NODE_TYPES.FunctionExpression\n\t\t\t) {\n\t\t\t\treturn parent;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\treturn autoFix\n\t\t\t? {\n\t\t\t\t\t// TODO: a selector for the parameters only\n\t\t\t\t\tDecorator(node) {\n\t\t\t\t\t\tconst parent = getDecorated(node);\n\t\t\t\t\t\tif (!parent) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the current node comes from there\n\t\t\t\t\t\tconst decorators = parent.decorators!;\n\n\t\t\t\t\t\t// Run the listener only when on the first node\n\t\t\t\t\t\tif (decorators[0] === node) {\n\t\t\t\t\t\t\tsortRuleListener(context, decorators, optionsWithDefault);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tDecorator(node) {\n\t\t\t\t\t\tconst parent = getDecorated(node);\n\t\t\t\t\t\tif (!parent) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the current node comes from there\n\t\t\t\t\t\tconst decorators = parent.decorators!;\n\n\t\t\t\t\t\t// Get only the decorators after the current one\n\t\t\t\t\t\tconst nodeIndex = decorators.findIndex(decorator => decorator === node);\n\t\t\t\t\t\tsortRuleListener(context, decorators.slice(nodeIndex), optionsWithDefault);\n\t\t\t\t\t}\n\t\t\t };\n\t},\n\tmeta: {\n\t\tdocs: {\n\t\t\tdescription: \"Enforces order of parameters decorators\"\n\t\t}\n\t},\n\tname: SORT_ON_PARAMETERS_NAME\n});\n","import { AST_NODE_TYPES } from \"@typescript-eslint/types\";\n\nimport { createSortRule, sortRuleListener } from \"../lib/sort-rule\";\n\nexport const SORT_ON_PROPERTIES_NAME = \"sort-on-properties\";\n\nexport const sortOnProperties = createSortRule({\n\tcreate: (context, [optionsWithDefault]) => {\n\t\tconst { autoFix } = optionsWithDefault;\n\n\t\treturn autoFix\n\t\t\t? {\n\t\t\t\t\tPropertyDefinition({ decorators }) {\n\t\t\t\t\t\tsortRuleListener(context, decorators ?? [], optionsWithDefault);\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tDecorator(node) {\n\t\t\t\t\t\tconst { parent } = node;\n\t\t\t\t\t\tif (parent?.type !== AST_NODE_TYPES.PropertyDefinition) {\n\t\t\t\t\t\t\t// Only for property decorator\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the current node comes from there\n\t\t\t\t\t\tconst decorators = parent.decorators!;\n\n\t\t\t\t\t\t// Get only the decorators after the current one\n\t\t\t\t\t\tconst nodeIndex = decorators.findIndex(decorator => decorator === node);\n\t\t\t\t\t\tsortRuleListener(context, decorators.slice(nodeIndex), optionsWithDefault);\n\t\t\t\t\t}\n\t\t\t };\n\t},\n\tmeta: {\n\t\tdocs: {\n\t\t\tdescription: \"Enforces order of properties decorators\"\n\t\t}\n\t},\n\tname: SORT_ON_PROPERTIES_NAME\n});\n","import { TSESLint } from \"@typescript-eslint/utils\";\n\nimport {\n\tSORT_ON_ACCESSORS_NAME,\n\tSORT_ON_CLASSES_NAME,\n\tSORT_ON_METHODS_NAME,\n\tSORT_ON_PARAMETERS_NAME,\n\tSORT_ON_PROPERTIES_NAME,\n\tsortOnAccessors,\n\tsortOnClasses,\n\tsortOnMethods,\n\tsortOnParameters,\n\tsortOnProperties\n} from \"./rules\";\n\nexport default {\n\trules: {\n\t\t[SORT_ON_ACCESSORS_NAME]: sortOnAccessors,\n\t\t[SORT_ON_CLASSES_NAME]: sortOnClasses,\n\t\t[SORT_ON_METHODS_NAME]: sortOnMethods,\n\t\t[SORT_ON_PARAMETERS_NAME]: sortOnParameters,\n\t\t[SORT_ON_PROPERTIES_NAME]: sortOnProperties\n\t}\n} satisfies TSESLint.Linter.Plugin;\n"]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Enforces order of accessors decorators (`sort-decorators/sort-on-accessors`)
|
|
2
|
+
|
|
3
|
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
|
+
|
|
7
|
+
Sort decorators on accessors.
|
|
8
|
+
|
|
9
|
+
## Options
|
|
10
|
+
|
|
11
|
+
| Name | Description | value |
|
|
12
|
+
|:----------------|:-------------------------------------------------------------------------|:----------------|
|
|
13
|
+
| `autoFix` | Automatically fix the order.<br/>Decorators order can matter at runtime. | *boolean* |
|
|
14
|
+
| `caseSensitive` | If true, enforce properties to be in case-sensitive order. | *boolean* |
|
|
15
|
+
| `direction` | Specify the direction of the ordering. | `asc` \| `desc` |
|
|
16
|
+
|
|
17
|
+
> Definitive information in the [JSON schema](../../src/lib/sort-rule/sort-rule.options.schema.json).
|
|
18
|
+
|
|
19
|
+
### Defaults
|
|
20
|
+
|
|
21
|
+
This is the default values when the rule is enabled:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"sort-decorators/sort-on-accessors": [
|
|
26
|
+
"warn",
|
|
27
|
+
{
|
|
28
|
+
"autoFix": false,
|
|
29
|
+
"caseSensitive": true,
|
|
30
|
+
"direction": "asc"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Usage
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary>Usage of <code>"caseSensitive": false</code></summary>
|
|
40
|
+
|
|
41
|
+
#### Configuration
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"sort-decorators/sort-on-accessors": [
|
|
46
|
+
"warn",
|
|
47
|
+
{
|
|
48
|
+
"caseSensitive": false
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### ❌ Invalid
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
class MyClass {
|
|
58
|
+
@B @a @c
|
|
59
|
+
public get accessor() { return 0; }
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### ✅ Valid
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
class MyClass {
|
|
67
|
+
@a @B @c
|
|
68
|
+
public get accessor() { return 0; }
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
</details>
|
|
73
|
+
|
|
74
|
+
<br />
|
|
75
|
+
|
|
76
|
+
<details>
|
|
77
|
+
<summary>Usage of <code>"direction": "desc"</code></summary>
|
|
78
|
+
|
|
79
|
+
#### Configuration
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"sort-decorators/sort-on-accessors": [
|
|
84
|
+
"warn",
|
|
85
|
+
{
|
|
86
|
+
"direction": "desc"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### ❌ Invalid
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
class MyClass {
|
|
96
|
+
@A
|
|
97
|
+
@B
|
|
98
|
+
public get accessor() { return 0; }
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### ✅ Valid
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
class MyClass {
|
|
106
|
+
@B
|
|
107
|
+
@A
|
|
108
|
+
public get accessor() { return 0; }
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
</details>
|
|
113
|
+
|
|
114
|
+
<br />
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Enforces order of class decorators (`sort-decorators/sort-on-classes`)
|
|
2
|
+
|
|
3
|
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
|
+
|
|
7
|
+
Sort decorators on classes.
|
|
8
|
+
|
|
9
|
+
## Options
|
|
10
|
+
|
|
11
|
+
| Name | Description | value |
|
|
12
|
+
|:----------------|:-------------------------------------------------------------------------|:----------------|
|
|
13
|
+
| `autoFix` | Automatically fix the order.<br/>Decorators order can matter at runtime. | *boolean* |
|
|
14
|
+
| `caseSensitive` | If true, enforce properties to be in case-sensitive order. | *boolean* |
|
|
15
|
+
| `direction` | Specify the direction of the ordering. | `asc` \| `desc` |
|
|
16
|
+
|
|
17
|
+
> Definitive information in the [JSON schema](../../src/lib/sort-rule/sort-rule.options.schema.json).
|
|
18
|
+
|
|
19
|
+
### Defaults
|
|
20
|
+
|
|
21
|
+
This is the default values when the rule is enabled:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"sort-decorators/sort-on-classes": [
|
|
26
|
+
"warn",
|
|
27
|
+
{
|
|
28
|
+
"autoFix": false,
|
|
29
|
+
"caseSensitive": true,
|
|
30
|
+
"direction": "asc"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Usage
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary>Usage of <code>"caseSensitive": false</code></summary>
|
|
40
|
+
|
|
41
|
+
#### Configuration
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"sort-decorators/sort-on-classes": [
|
|
46
|
+
"warn",
|
|
47
|
+
{
|
|
48
|
+
"caseSensitive": false
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### ❌ Invalid
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
@B @a @c
|
|
58
|
+
class MyClass {}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### ✅ Valid
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
@a @B @c
|
|
65
|
+
class MyClass {}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
</details>
|
|
69
|
+
|
|
70
|
+
<br />
|
|
71
|
+
|
|
72
|
+
<details>
|
|
73
|
+
<summary>Usage of <code>"direction": "desc"</code></summary>
|
|
74
|
+
|
|
75
|
+
#### Configuration
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"sort-decorators/sort-on-classes": [
|
|
80
|
+
"warn",
|
|
81
|
+
{
|
|
82
|
+
"direction": "desc"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### ❌ Invalid
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
@A
|
|
92
|
+
@B
|
|
93
|
+
class MyClass {}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### ✅ Valid
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
@B
|
|
100
|
+
@A
|
|
101
|
+
class MyClass {}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
</details>
|
|
105
|
+
|
|
106
|
+
<br />
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Enforces order of methods decorators (`sort-decorators/sort-on-methods`)
|
|
2
|
+
|
|
3
|
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
|
+
|
|
7
|
+
Sort decorators on methods.
|
|
8
|
+
|
|
9
|
+
## Options
|
|
10
|
+
|
|
11
|
+
| Name | Description | value |
|
|
12
|
+
|:----------------|:-------------------------------------------------------------------------|:----------------|
|
|
13
|
+
| `autoFix` | Automatically fix the order.<br/>Decorators order can matter at runtime. | *boolean* |
|
|
14
|
+
| `caseSensitive` | If true, enforce properties to be in case-sensitive order. | *boolean* |
|
|
15
|
+
| `direction` | Specify the direction of the ordering. | `asc` \| `desc` |
|
|
16
|
+
|
|
17
|
+
> Definitive information in the [JSON schema](../../src/lib/sort-rule/sort-rule.options.schema.json).
|
|
18
|
+
|
|
19
|
+
### Defaults
|
|
20
|
+
|
|
21
|
+
This is the default values when the rule is enabled:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"sort-decorators/sort-on-methods": [
|
|
26
|
+
"warn",
|
|
27
|
+
{
|
|
28
|
+
"autoFix": false,
|
|
29
|
+
"caseSensitive": true,
|
|
30
|
+
"direction": "asc"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Usage
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary>Usage of <code>"caseSensitive": false</code></summary>
|
|
40
|
+
|
|
41
|
+
#### Configuration
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"sort-decorators/sort-on-methods": [
|
|
46
|
+
"warn",
|
|
47
|
+
{
|
|
48
|
+
"caseSensitive": false
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### ❌ Invalid
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
class MyClass {
|
|
58
|
+
@B @a @c
|
|
59
|
+
public run() {}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### ✅ Valid
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
class MyClass {
|
|
67
|
+
@a @B @c
|
|
68
|
+
public run() {}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
</details>
|
|
73
|
+
|
|
74
|
+
<br />
|
|
75
|
+
|
|
76
|
+
<details>
|
|
77
|
+
<summary>Usage of <code>"direction": "desc"</code></summary>
|
|
78
|
+
|
|
79
|
+
#### Configuration
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"sort-decorators/sort-on-methods": [
|
|
84
|
+
"warn",
|
|
85
|
+
{
|
|
86
|
+
"direction": "desc"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### ❌ Invalid
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
class MyClass {
|
|
96
|
+
@A
|
|
97
|
+
@B
|
|
98
|
+
public run() {}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### ✅ Valid
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
class MyClass {
|
|
106
|
+
@B
|
|
107
|
+
@A
|
|
108
|
+
public run() {}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
</details>
|
|
113
|
+
|
|
114
|
+
<br />
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Enforces order of parameters decorators (`sort-decorators/sort-on-parameters`)
|
|
2
|
+
|
|
3
|
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
|
+
|
|
7
|
+
Sort decorators on parameters.
|
|
8
|
+
|
|
9
|
+
## Options
|
|
10
|
+
|
|
11
|
+
| Name | Description | value |
|
|
12
|
+
|:----------------|:-------------------------------------------------------------------------|:----------------|
|
|
13
|
+
| `autoFix` | Automatically fix the order.<br/>Decorators order can matter at runtime. | *boolean* |
|
|
14
|
+
| `caseSensitive` | If true, enforce properties to be in case-sensitive order. | *boolean* |
|
|
15
|
+
| `direction` | Specify the direction of the ordering. | `asc` \| `desc` |
|
|
16
|
+
|
|
17
|
+
> Definitive information in the [JSON schema](../../src/lib/sort-rule/sort-rule.options.schema.json).
|
|
18
|
+
|
|
19
|
+
### Defaults
|
|
20
|
+
|
|
21
|
+
This is the default values when the rule is enabled:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"sort-decorators/sort-on-parameters": [
|
|
26
|
+
"warn",
|
|
27
|
+
{
|
|
28
|
+
"autoFix": false,
|
|
29
|
+
"caseSensitive": true,
|
|
30
|
+
"direction": "asc"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Usage
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary>Usage of <code>"caseSensitive": false</code></summary>
|
|
40
|
+
|
|
41
|
+
#### Configuration
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"sort-decorators/sort-on-parameters": [
|
|
46
|
+
"warn",
|
|
47
|
+
{
|
|
48
|
+
"caseSensitive": false
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### ❌ Invalid
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
class MyClass {
|
|
58
|
+
public run(@B @a @c parameter?: number) {}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### ✅ Valid
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
class MyClass {
|
|
66
|
+
public run(@a @B @c parameter?: number) {}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
</details>
|
|
71
|
+
|
|
72
|
+
<br />
|
|
73
|
+
|
|
74
|
+
<details>
|
|
75
|
+
<summary>Usage of <code>"direction": "desc"</code></summary>
|
|
76
|
+
|
|
77
|
+
#### Configuration
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"sort-decorators/sort-on-parameters": [
|
|
82
|
+
"warn",
|
|
83
|
+
{
|
|
84
|
+
"direction": "desc"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### ❌ Invalid
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
class MyClass {
|
|
94
|
+
public run(
|
|
95
|
+
@A
|
|
96
|
+
@B
|
|
97
|
+
parameter?: number
|
|
98
|
+
) {}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### ✅ Valid
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
class MyClass {
|
|
106
|
+
public run(
|
|
107
|
+
@B
|
|
108
|
+
@A
|
|
109
|
+
parameter?: number
|
|
110
|
+
) {}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
</details>
|
|
115
|
+
|
|
116
|
+
<br />
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Enforces order of properties decorators (`sort-decorators/sort-on-properties`)
|
|
2
|
+
|
|
3
|
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
4
|
+
|
|
5
|
+
<!-- end auto-generated rule header -->
|
|
6
|
+
|
|
7
|
+
Sort decorators on properties.
|
|
8
|
+
|
|
9
|
+
## Options
|
|
10
|
+
|
|
11
|
+
| Name | Description | value |
|
|
12
|
+
|:----------------|:-------------------------------------------------------------------------|:----------------|
|
|
13
|
+
| `autoFix` | Automatically fix the order.<br/>Decorators order can matter at runtime. | *boolean* |
|
|
14
|
+
| `caseSensitive` | If true, enforce properties to be in case-sensitive order. | *boolean* |
|
|
15
|
+
| `direction` | Specify the direction of the ordering. | `asc` \| `desc` |
|
|
16
|
+
|
|
17
|
+
> Definitive information in the [JSON schema](../../src/lib/sort-rule/sort-rule.options.schema.json).
|
|
18
|
+
|
|
19
|
+
### Defaults
|
|
20
|
+
|
|
21
|
+
This is the default values when the rule is enabled:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"sort-decorators/sort-on-properties": [
|
|
26
|
+
"warn",
|
|
27
|
+
{
|
|
28
|
+
"autoFix": false,
|
|
29
|
+
"caseSensitive": true,
|
|
30
|
+
"direction": "asc"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Usage
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary>Usage of <code>"caseSensitive": false</code></summary>
|
|
40
|
+
|
|
41
|
+
#### Configuration
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"sort-decorators/sort-on-properties": [
|
|
46
|
+
"warn",
|
|
47
|
+
{
|
|
48
|
+
"caseSensitive": false
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### ❌ Invalid
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
class MyClass {
|
|
58
|
+
@B @a @c
|
|
59
|
+
public property?: number;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### ✅ Valid
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
class MyClass {
|
|
67
|
+
@a @B @c
|
|
68
|
+
public property?: number;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
</details>
|
|
73
|
+
|
|
74
|
+
<br />
|
|
75
|
+
|
|
76
|
+
<details>
|
|
77
|
+
<summary>Usage of <code>"direction": "desc"</code></summary>
|
|
78
|
+
|
|
79
|
+
#### Configuration
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"sort-decorators/sort-on-properties": [
|
|
84
|
+
"warn",
|
|
85
|
+
{
|
|
86
|
+
"direction": "desc"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### ❌ Invalid
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
class MyClass {
|
|
96
|
+
@A
|
|
97
|
+
@B
|
|
98
|
+
public property?: number;
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### ✅ Valid
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
class MyClass {
|
|
106
|
+
@B
|
|
107
|
+
@A
|
|
108
|
+
public property?: number;
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
</details>
|
|
113
|
+
|
|
114
|
+
<br />
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "heap-code",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/heap-code/eslint-plugin-sort-decorators/issues"
|
|
5
|
+
},
|
|
6
|
+
"config": {
|
|
7
|
+
"commitizen": {
|
|
8
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@typescript-eslint/utils": "^5.0.0"
|
|
13
|
+
},
|
|
14
|
+
"description": "An ESLint plugin to sort decorators",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@cspell/eslint-plugin": "^6.31.1",
|
|
17
|
+
"@release-it/conventional-changelog": "^5.1.1",
|
|
18
|
+
"@shopify/eslint-plugin": "^42.1.0",
|
|
19
|
+
"@swc/core": "^1.3.67",
|
|
20
|
+
"@types/eslint": "^8.40.2",
|
|
21
|
+
"@types/jest": "^29.5.2",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
23
|
+
"@typescript-eslint/parser": "^5.60.1",
|
|
24
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
25
|
+
"eslint": "^8.43.0",
|
|
26
|
+
"eslint-config-prettier": "^8.8.0",
|
|
27
|
+
"eslint-doc-generator": "^1.4.3",
|
|
28
|
+
"eslint-plugin-eslint-plugin": "^5.1.0",
|
|
29
|
+
"eslint-plugin-etc": "^2.0.3",
|
|
30
|
+
"eslint-plugin-import": "^2.27.5",
|
|
31
|
+
"eslint-plugin-jest": "^27.2.2",
|
|
32
|
+
"eslint-plugin-jest-extended": "^2.0.0",
|
|
33
|
+
"eslint-plugin-jsdoc": "^46.4.2",
|
|
34
|
+
"eslint-plugin-jsonc": "^2.9.0",
|
|
35
|
+
"eslint-plugin-markdownlint": "^0.4.1",
|
|
36
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
37
|
+
"eslint-plugin-sonarjs": "^0.19.0",
|
|
38
|
+
"eslint-plugin-sort-destructure-keys": "^1.5.0",
|
|
39
|
+
"eslint-plugin-sort-exports": "^0.8.0",
|
|
40
|
+
"eslint-plugin-typescript-sort-keys": "^2.3.0",
|
|
41
|
+
"eslint-plugin-unicorn": "^47.0.0",
|
|
42
|
+
"eslint-plugin-unused-imports": "^2.0.0",
|
|
43
|
+
"eslint-plugin-yml": "^1.8.0",
|
|
44
|
+
"jest": "^29.5.0",
|
|
45
|
+
"jest-extended": "^4.0.0",
|
|
46
|
+
"release-it": "^15.11.0",
|
|
47
|
+
"ts-jest": "^29.1.0",
|
|
48
|
+
"ts-loader": "^9.4.4",
|
|
49
|
+
"ts-node": "^10.9.1",
|
|
50
|
+
"tsup": "^7.1.0",
|
|
51
|
+
"typescript": "^5.1.5",
|
|
52
|
+
"typescript-json-schema": "^0.58.1"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/heap-code/eslint-plugin-sort-decorators",
|
|
55
|
+
"keywords": [
|
|
56
|
+
"eslint",
|
|
57
|
+
"eslintplugin",
|
|
58
|
+
"decorators",
|
|
59
|
+
"sort",
|
|
60
|
+
"plugin"
|
|
61
|
+
],
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"main": "./dist/index.js",
|
|
64
|
+
"name": "eslint-plugin-sort-decorators",
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
67
|
+
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/heap-code/eslint-plugin-sort-decorators.git"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "tsup-node src/index.ts --minify --sourcemap --treeshake",
|
|
78
|
+
"docs:update": "npx eslint-doc-generator",
|
|
79
|
+
"lint": "eslint .",
|
|
80
|
+
"lint:fix": "npm run lint -- --fix",
|
|
81
|
+
"postschemas:update": "eslint src/lib/sort-rule/sort-rule.options.schema.json --fix",
|
|
82
|
+
"schemas:update": "typescript-json-schema src/lib/sort-rule/sort-rule.options.ts SortRuleOptions --noExtraProps --required -o src/lib/sort-rule/sort-rule.options.schema.json",
|
|
83
|
+
"test": "jest --config jest.config.ts",
|
|
84
|
+
"test:coverage": "npm run test -- --coverage",
|
|
85
|
+
"test:watch": "npm run test -- --watch"
|
|
86
|
+
},
|
|
87
|
+
"version": "0.1.0"
|
|
88
|
+
}
|