Skip to content

Commit 36fb96d

Browse files
committed
upgrade pri and fix lint
1 parent b05b94f commit 36fb96d

File tree

23 files changed

+211
-207
lines changed

23 files changed

+211
-207
lines changed

.eslintrc

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
"semi": true,
5555
"singleQuote": true,
5656
"tabWidth": 2,
57-
"useTabs": false
57+
"useTabs": false,
58+
"trailingComma": "all"
5859
}
5960
],
6061
"func-names": 0,
@@ -66,13 +67,15 @@
6667
"no-unused-expressions": 1,
6768
"new-cap": 2,
6869
"prefer-arrow-callback": 2,
69-
"arrow-body-style": [
70-
2,
71-
"always"
72-
],
70+
"arrow-body-style": 0,
7371
"max-len": [
7472
1,
75-
120
73+
{
74+
"code": 120,
75+
"ignoreStrings": true,
76+
"ignoreUrls": true,
77+
"ignoreRegExpLiterals": true
78+
}
7679
],
7780
"consistent-return": "off",
7881
"default-case": 2,
@@ -94,14 +97,15 @@
9497
"eol-last": 2,
9598
"no-useless-rename": 2,
9699
"class-methods-use-this": 0,
97-
"prefer-destructuring": 2,
100+
"prefer-destructuring": 0,
98101
"no-unused-vars": 0,
99102
"@typescript-eslint/no-unused-vars": 1,
100103
"react/self-closing-comp": 2,
101104
"react/jsx-indent-props": [
102105
2,
103106
2
104107
],
108+
"no-plusplus": 0,
105109
"react/jsx-uses-vars": 1,
106110
"react/no-multi-comp": [
107111
2,
@@ -113,12 +117,7 @@
113117
"react/react-in-jsx-scope": 2,
114118
"react/sort-comp": 1,
115119
"react/jsx-tag-spacing": 2,
116-
"react/jsx-no-bind": [
117-
2,
118-
{
119-
"allowArrowFunctions": true
120-
}
121-
],
120+
"react/jsx-no-bind": 0,
122121
"react/jsx-closing-bracket-location": 2,
123122
"react/prefer-stateless-function": 0,
124123
"react/display-name": 0,
@@ -145,8 +144,14 @@
145144
"import/no-unresolved": 0,
146145
"react-hooks/rules-of-hooks": "error",
147146
"react-hooks/exhaustive-deps": "warn",
148-
"@typescript-eslint/explicit-member-accessibility": [
149-
0
147+
"@typescript-eslint/explicit-member-accessibility": 0,
148+
"@typescript-eslint/no-object-literal-type-assertion": 0,
149+
"react/no-find-dom-node": 1,
150+
"no-param-reassign": [
151+
2,
152+
{
153+
"props": false
154+
}
150155
]
151156
}
152157
}

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package-lock=false
1+
package-lock=true

docs/basic.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ const myLexer = createLexer([
2020
{
2121
type: 'whitespace',
2222
regexes: [/^(\s+)/],
23-
ignore: true
23+
ignore: true,
2424
},
2525
{
2626
type: 'word',
27-
regexes: [/^([a-zA-Z0-9]+)/]
27+
regexes: [/^([a-zA-Z0-9]+)/],
2828
},
2929
{
3030
type: 'operator',
31-
regexes: [/^(\+)/]
32-
}
31+
regexes: [/^(\+)/],
32+
},
3333
]);
3434

3535
const root = () => {
@@ -43,7 +43,7 @@ const addExpr = () => {
4343
return {
4444
left: ast[0].value,
4545
operator: ast[1] && ast[1][0].operator,
46-
right: ast[1] && ast[1][0].term
46+
right: ast[1] && ast[1][0].term,
4747
};
4848
});
4949
};
@@ -52,14 +52,14 @@ const addPlus = () => {
5252
return chain(['+', '-'], root)(ast => {
5353
return {
5454
operator: ast[0].value,
55-
term: ast[1]
55+
term: ast[1],
5656
};
5757
});
5858
};
5959

6060
const myParser = createParser(
6161
root, // Root grammar.
62-
myLexer // Created in lexer example.
62+
myLexer, // Created in lexer example.
6363
);
6464

6565
// eslint-disable-next-line no-console

docs/monaco-editor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class Page extends React.PureComponent<Props, State> {
2323
// eslint-disable-next-line react/no-find-dom-node
2424
const editor = monaco.editor.create(ReactDOM.findDOMNode(this.root), {
2525
value: [''].join('\n'),
26-
language: 'sql'
26+
language: 'sql',
2727
});
2828
monacoSqlAutocomplete(monaco, editor);
2929
});
@@ -55,7 +55,7 @@ function loadMonacoEditor() {
5555
baseUrl: 'https://unpkg.com/monaco-editor/min/'
5656
};
5757
importScripts('https://unpkg.com/monaco-editor/min/vs/base/worker/workerMain.js');`)}`;
58-
}
58+
},
5959
};
6060

6161
// eslint-disable-next-line import/no-dynamic-require

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111
"preview": "pri preview",
1212
"analyse": "pri analyse",
1313
"test": "pri test",
14-
"format": "eslint --fix './?(src|packages|docs|tests)/**/*.?(ts|tsx)'",
14+
"format": "pri lint",
1515
"prepublishOnly": "npm run build && npm run bundle --skipLint",
1616
"bundle": "pri bundle",
1717
"release": "npm publish",
18-
"posttest": "codecov -f coverage/*.json -t dc6610f3-32ac-4d30-8676-74d3888349a0"
18+
"posttest": "codecov -f coverage/*.json -t dc6610f3-32ac-4d30-8676-74d3888349a0",
19+
"publish": "pri publish",
20+
"lint": "pri lint"
1921
},
2022
"devDependencies": {
2123
"pri": "^3.0.0"
2224
},
23-
"main": "dist/index.js",
25+
"main": "dist/main",
2426
"types": "declaration/index.d.ts",
2527
"peerDependencies": {},
2628
"dependencies": {
@@ -30,5 +32,6 @@
3032
"hooks": {
3133
"pre-commit": "npm test -- --package root"
3234
}
33-
}
35+
},
36+
"module": "dist/module"
3437
}

priconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"type": "component"
2+
"type": "component",
3+
"packageLock": true
34
}

src/demo/monaco-plugin/default-opts.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ export class DefaultOpts {
3030
label: name,
3131
insertText: name,
3232
sortText: `A${name}`,
33-
kind: this.monaco.languages.CompletionItemKind.Folder
33+
kind: this.monaco.languages.CompletionItemKind.Folder,
3434
};
35-
})
35+
}),
3636
);
3737
};
3838

3939
public onSuggestTableFields?: (
4040
tableInfo?: ITableInfo,
4141
cursorValue?: string,
42-
rootStatement?: IStatement
42+
rootStatement?: IStatement,
4343
) => Promise<ICompletionItem[]> = tableInfo => {
4444
return Promise.resolve(
4545
['aa', 'bb', 'cc']
@@ -51,9 +51,9 @@ export class DefaultOpts {
5151
label: fieldName,
5252
insertText: fieldName,
5353
sortText: `B${fieldName}`,
54-
kind: this.monaco.languages.CompletionItemKind.Field
54+
kind: this.monaco.languages.CompletionItemKind.Field,
5555
};
56-
})
56+
}),
5757
);
5858
};
5959

@@ -72,7 +72,7 @@ export class DefaultOpts {
7272
documentation: 'documentation',
7373
detail: 'detail',
7474
kind: this.monaco.languages.CompletionItemKind.Keyword,
75-
sortText: `W${matching.value}`
75+
sortText: `W${matching.value}`,
7676
};
7777
});
7878
};
@@ -84,9 +84,9 @@ export class DefaultOpts {
8484
label: each,
8585
insertText: each,
8686
sortText: `C${each}`,
87-
kind: this.monaco.languages.CompletionItemKind.Function
87+
kind: this.monaco.languages.CompletionItemKind.Function,
8888
};
89-
})
89+
}),
9090
);
9191
};
9292

@@ -95,34 +95,34 @@ export class DefaultOpts {
9595
label: tableNameOrAlias,
9696
insertText: tableNameOrAlias,
9797
sortText: `D${tableNameOrAlias}`,
98-
kind: this.monaco.languages.CompletionItemKind.Folder
98+
kind: this.monaco.languages.CompletionItemKind.Folder,
9999
};
100100
};
101101

102102
public onHoverTableField?: (fieldName?: string, extra?: ICompletionItem) => Promise<any> = (...args) => {
103103
return Promise.resolve([
104104
{ value: 'onHoverTableField' },
105105
{
106-
value: `\`\`\`json\n${JSON.stringify(args, null, 2)}\n\`\`\``
107-
}
106+
value: `\`\`\`json\n${JSON.stringify(args, null, 2)}\n\`\`\``,
107+
},
108108
]);
109109
};
110110

111111
public onHoverTableName?: (cursorInfo?: ICursorInfo) => Promise<any> = (...args) => {
112112
return Promise.resolve([
113113
{ value: 'onHoverTableName' },
114114
{
115-
value: `\`\`\`json\n${JSON.stringify(args, null, 2)}\n\`\`\``
116-
}
115+
value: `\`\`\`json\n${JSON.stringify(args, null, 2)}\n\`\`\``,
116+
},
117117
]);
118118
};
119119

120120
public onHoverFunctionName?: (functionName?: string) => Promise<any> = (...args) => {
121121
return Promise.resolve([
122122
{ value: 'onHoverFunctionName' },
123123
{
124-
value: `\`\`\`json\n${JSON.stringify(args, null, 2)}\n\`\`\``
125-
}
124+
value: `\`\`\`json\n${JSON.stringify(args, null, 2)}\n\`\`\``,
125+
},
126126
]);
127127
};
128128
}

0 commit comments

Comments
 (0)