xshell 1.3.41 → 1.3.42
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/package.json +1 -1
- package/xlint.js +2 -126
package/package.json
CHANGED
package/xlint.js
CHANGED
|
@@ -759,113 +759,6 @@ export const xlint_plugin = {
|
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
// 规则太复杂了,暂时写不出来
|
|
763
|
-
// ... color ? [ ] : [
|
|
764
|
-
// '-c', 'color.status=false',
|
|
765
|
-
// '-c', 'color.ui=false',
|
|
766
|
-
// '-c', 'color.branch=false',
|
|
767
|
-
// '-c', 'color.ui=false',
|
|
768
|
-
// ],
|
|
769
|
-
// test ?
|
|
770
|
-
// ...
|
|
771
|
-
// : [ ]
|
|
772
|
-
// 'conditional-expresssion-style': {
|
|
773
|
-
// meta,
|
|
774
|
-
// create (context) {
|
|
775
|
-
// const source = context.sourceCode
|
|
776
|
-
// const lines = source.getLines()
|
|
777
|
-
// return {
|
|
778
|
-
// ConditionalExpression (node) {
|
|
779
|
-
// const question = source.getTokenAfter(node.test, not_closing_paren)
|
|
780
|
-
// const colon = source.getTokenAfter(node.consequent, not_closing_paren)
|
|
781
|
-
// const test_tail = source.getTokenBefore(question, { includeComments: true })
|
|
782
|
-
// const test_head = source.getFirstToken(node, { includeComments: true })
|
|
783
|
-
// const consequent_start = source.getTokenAfter(question, not_opening_paren)
|
|
784
|
-
// const consequent_tail = source.getTokenBefore(colon, not_closing_paren)
|
|
785
|
-
// const alternate_start = source.getTokenAfter(colon, not_opening_paren)
|
|
786
|
-
// const node_tail = source.getLastToken(node)
|
|
787
|
-
// // 三元运算符的 ? 应该和 test 条件末尾在同一行
|
|
788
|
-
// if (test_tail.loc.start.line !== question.loc.start.line)
|
|
789
|
-
// context.report({
|
|
790
|
-
// node,
|
|
791
|
-
// loc: {
|
|
792
|
-
// start: colon.loc.start,
|
|
793
|
-
// end: colon.loc.end
|
|
794
|
-
// },
|
|
795
|
-
// message: '条件表达式的 ? 应该和 test 条件末尾在同一行',
|
|
796
|
-
// fix: fixer => fixer.replaceTextRange([test_tail.range[1], colon.range[0]], ' ')
|
|
797
|
-
// })
|
|
798
|
-
// // 单行的条件表达式
|
|
799
|
-
// if (colon.loc.start.line === question.loc.start.line) {
|
|
800
|
-
// const alternate_start_with_comments = source.getTokenAfter(colon, { includeComments: true, filter: not_opening_paren })
|
|
801
|
-
// if (node_tail.loc.end.line !== colon.loc.start.line)
|
|
802
|
-
// context.report({
|
|
803
|
-
// node,
|
|
804
|
-
// loc: {
|
|
805
|
-
// start: node.alternate.loc.start,
|
|
806
|
-
// end: node_tail.loc.end
|
|
807
|
-
// },
|
|
808
|
-
// message: '单行条件表达式的 else 条件也应该在同一行',
|
|
809
|
-
// fix: fixer => fixer.replaceTextRange([colon.range[1], alternate_start_with_comments.range[0]], ' ')
|
|
810
|
-
// })
|
|
811
|
-
// } else { // 多行条件表达式
|
|
812
|
-
// if (consequent_tail.loc.end.line === colon.loc.start.line)
|
|
813
|
-
// context.report({
|
|
814
|
-
// node,
|
|
815
|
-
// loc: {
|
|
816
|
-
// start: consequent_tail.loc.start,
|
|
817
|
-
// end: colon.loc.start
|
|
818
|
-
// },
|
|
819
|
-
// message: '多行条件表达式的 : 应该在单独的一行',
|
|
820
|
-
// fix: fixer =>
|
|
821
|
-
// fixer.insertTextBefore(
|
|
822
|
-
// colon,
|
|
823
|
-
// '\n' +
|
|
824
|
-
// ' '.repeat(
|
|
825
|
-
// Math.max(split_indent(lines[consequent_tail.loc.end.line - 1]).indent - 4, 0)
|
|
826
|
-
// )
|
|
827
|
-
// )
|
|
828
|
-
// })
|
|
829
|
-
// if (
|
|
830
|
-
// alternate_start.loc.start.line === colon.loc.start.line &&
|
|
831
|
-
// (node.alternate.loc.start.line !== node.alternate.loc.end.line)
|
|
832
|
-
// )
|
|
833
|
-
// context.report({
|
|
834
|
-
// node,
|
|
835
|
-
// loc: {
|
|
836
|
-
// start: colon.loc.end,
|
|
837
|
-
// end: alternate_start.loc.start
|
|
838
|
-
// },
|
|
839
|
-
// message: '多行条件表达式的 : 应该在单独的一行',
|
|
840
|
-
// fix: fixer => fixer.insertTextBefore(
|
|
841
|
-
// alternate_start,
|
|
842
|
-
// '\n' +
|
|
843
|
-
// ' '.repeat(
|
|
844
|
-
// split_indent(lines[colon.loc.start.line - 1]).indent + 4
|
|
845
|
-
// )
|
|
846
|
-
// )
|
|
847
|
-
// })
|
|
848
|
-
// if (consequent_start.loc.start.line === question.loc.start.line)
|
|
849
|
-
// context.report({
|
|
850
|
-
// node,
|
|
851
|
-
// loc: {
|
|
852
|
-
// start: question.loc.end,
|
|
853
|
-
// end: test_head.loc.start
|
|
854
|
-
// },
|
|
855
|
-
// message: '多行条件表达式的 ? 这一行后面不应该有其他表达式,请换行',
|
|
856
|
-
// fix: fixer => fixer.insertTextBefore(
|
|
857
|
-
// consequent_start,
|
|
858
|
-
// '\n' +
|
|
859
|
-
// ' '.repeat(
|
|
860
|
-
// split_indent(lines[colon.loc.start.line - 1]).indent + 4
|
|
861
|
-
// )
|
|
862
|
-
// )
|
|
863
|
-
// })
|
|
864
|
-
// }
|
|
865
|
-
// }
|
|
866
|
-
// }
|
|
867
|
-
// }
|
|
868
|
-
// }
|
|
869
762
|
}
|
|
870
763
|
};
|
|
871
764
|
export const xlint_config = {
|
|
@@ -910,6 +803,7 @@ export const xlint_config = {
|
|
|
910
803
|
'xlint/keep-indent': 'error',
|
|
911
804
|
// 函数使用 function 来声明而不是 const foo = () => { }
|
|
912
805
|
'xlint/func-style': 'error',
|
|
806
|
+
'xlint/import': 'error',
|
|
913
807
|
'@stylistic/semi': ['error', 'never'],
|
|
914
808
|
'@stylistic/no-extra-semi': 'error',
|
|
915
809
|
'@stylistic/semi-style': ['error', 'first'],
|
|
@@ -1002,25 +896,7 @@ export const xlint_config = {
|
|
|
1002
896
|
],
|
|
1003
897
|
'@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports', disallowTypeAnnotations: false }],
|
|
1004
898
|
// () => { 返回 void 的表达式 }
|
|
1005
|
-
'@typescript-eslint/no-confusing-void-expression': 'error'
|
|
1006
|
-
// ------------ import
|
|
1007
|
-
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
1008
|
-
'import/order': [
|
|
1009
|
-
'error',
|
|
1010
|
-
{
|
|
1011
|
-
'newlines-between': 'always-and-inside-groups',
|
|
1012
|
-
pathGroups: [
|
|
1013
|
-
{
|
|
1014
|
-
pattern: '@/**',
|
|
1015
|
-
group: 'parent'
|
|
1016
|
-
},
|
|
1017
|
-
{
|
|
1018
|
-
pattern: '@i18n/**',
|
|
1019
|
-
group: 'parent'
|
|
1020
|
-
}
|
|
1021
|
-
]
|
|
1022
|
-
}
|
|
1023
|
-
]
|
|
899
|
+
'@typescript-eslint/no-confusing-void-expression': 'error'
|
|
1024
900
|
}
|
|
1025
901
|
};
|
|
1026
902
|
const line_break_pattern = /\r\n|[\r\n\u2028\u2029]/u;
|