sim-node-lib 0.4.3 → 0.4.5
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/dist/Eslint/index.d.ts +7 -0
- package/dist/Eslint/index.js +87 -0
- package/dist/Eslint/plugin/rules/ensure-bindings.d.ts +0 -0
- package/dist/Eslint/plugin/rules/ensure-bindings.js +33 -0
- package/dist/Eslint/plugin/sim-eslint.d.ts +10 -0
- package/dist/Eslint/plugin/sim-eslint.js +6 -0
- package/package.json +8 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const simEslint: any;
|
|
2
|
+
declare const eslintPluginPrettierRecommended: any;
|
|
3
|
+
declare const FlatCompat: any;
|
|
4
|
+
declare const compat: any;
|
|
5
|
+
declare function basic(dirname: string): any[];
|
|
6
|
+
declare function recommendedBasic(dirname: string): any[];
|
|
7
|
+
declare function recommendedTypeChecked(dirname: string): any[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const simEslint = require('./plugin/sim-eslint');
|
|
2
|
+
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
|
|
3
|
+
const { FlatCompat } = require('@eslint/eslintrc');
|
|
4
|
+
const compat = new FlatCompat({ resolvePluginsRelativeTo: __dirname });
|
|
5
|
+
function basic(dirname) {
|
|
6
|
+
return [
|
|
7
|
+
...compat.config({
|
|
8
|
+
plugins: ['@typescript-eslint'],
|
|
9
|
+
parser: '@typescript-eslint/parser',
|
|
10
|
+
parserOptions: {
|
|
11
|
+
project: true,
|
|
12
|
+
tsconfigRootDir: dirname,
|
|
13
|
+
},
|
|
14
|
+
ignorePatterns: ['database/**', 'build/**'],
|
|
15
|
+
}),
|
|
16
|
+
{
|
|
17
|
+
files: ['**/*.ts'],
|
|
18
|
+
ignores: ['/database/**/*.ts'],
|
|
19
|
+
languageOptions: {
|
|
20
|
+
sourceType: 'module',
|
|
21
|
+
ecmaVersion: 'latest',
|
|
22
|
+
},
|
|
23
|
+
plugins: { 'sim-eslint': simEslint },
|
|
24
|
+
rules: {
|
|
25
|
+
'sim-eslint/ensure-bindings': 'error',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
eslintPluginPrettierRecommended,
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
function recommendedBasic(dirname) {
|
|
32
|
+
return [
|
|
33
|
+
...compat.config({
|
|
34
|
+
extends: ['plugin:@typescript-eslint/recommended'],
|
|
35
|
+
plugins: ['@typescript-eslint'],
|
|
36
|
+
parser: '@typescript-eslint/parser',
|
|
37
|
+
parserOptions: {
|
|
38
|
+
project: true,
|
|
39
|
+
tsconfigRootDir: dirname,
|
|
40
|
+
},
|
|
41
|
+
ignorePatterns: ['database/**', 'build/**'],
|
|
42
|
+
}),
|
|
43
|
+
{
|
|
44
|
+
files: ['**/*.ts'],
|
|
45
|
+
ignores: ['/database/**/*.ts'],
|
|
46
|
+
languageOptions: {
|
|
47
|
+
sourceType: 'module',
|
|
48
|
+
ecmaVersion: 'latest',
|
|
49
|
+
},
|
|
50
|
+
plugins: { 'sim-eslint': simEslint },
|
|
51
|
+
rules: {
|
|
52
|
+
'sim-eslint/ensure-bindings': 'error',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
eslintPluginPrettierRecommended,
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
function recommendedTypeChecked(dirname) {
|
|
59
|
+
return [
|
|
60
|
+
...compat.config({
|
|
61
|
+
extends: ['plugin:@typescript-eslint/recommended-type-checked'],
|
|
62
|
+
plugins: ['@typescript-eslint'],
|
|
63
|
+
parser: '@typescript-eslint/parser',
|
|
64
|
+
parserOptions: {
|
|
65
|
+
project: true,
|
|
66
|
+
tsconfigRootDir: dirname,
|
|
67
|
+
},
|
|
68
|
+
ignorePatterns: ['database/**', 'build/**'],
|
|
69
|
+
}),
|
|
70
|
+
{
|
|
71
|
+
files: ['**/*.ts'],
|
|
72
|
+
ignores: ['/database/**/*.ts'],
|
|
73
|
+
languageOptions: {
|
|
74
|
+
sourceType: 'module',
|
|
75
|
+
ecmaVersion: 'latest',
|
|
76
|
+
},
|
|
77
|
+
plugins: { 'sim-eslint': simEslint },
|
|
78
|
+
rules: {
|
|
79
|
+
'sim-eslint/ensure-bindings': 'error',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
eslintPluginPrettierRecommended,
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
module.exports.basic = basic;
|
|
86
|
+
module.exports.recommendedBasic = recommendedBasic;
|
|
87
|
+
module.exports.recommendedTypeChecked = recommendedTypeChecked;
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
meta: {
|
|
3
|
+
type: 'problem',
|
|
4
|
+
docs: {
|
|
5
|
+
description: 'Enforce passing both query and bindings parameters to whereRaw() or rawQuery() method.',
|
|
6
|
+
},
|
|
7
|
+
},
|
|
8
|
+
create: function (context) {
|
|
9
|
+
return {
|
|
10
|
+
CallExpression(node) {
|
|
11
|
+
const callee = node.callee;
|
|
12
|
+
if (callee.type === 'MemberExpression' &&
|
|
13
|
+
callee.property.type === 'Identifier' &&
|
|
14
|
+
callee.property.name === 'whereRaw' &&
|
|
15
|
+
node.arguments.length !== 2) {
|
|
16
|
+
context.report({
|
|
17
|
+
node,
|
|
18
|
+
message: 'whereRaw() must be called with exactly 2 parameters.',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (callee.type === 'MemberExpression' &&
|
|
22
|
+
callee.property.type === 'Identifier' &&
|
|
23
|
+
callee.property.name === 'rawQuery' &&
|
|
24
|
+
node.arguments.length !== 2) {
|
|
25
|
+
context.report({
|
|
26
|
+
node,
|
|
27
|
+
message: 'rawQuery() must be called with exactly 2 parameters.',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sim-node-lib",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Library from SIMLabs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,10 +30,17 @@
|
|
|
30
30
|
"@adonisjs/lucid": "^18.4.0",
|
|
31
31
|
"@adonisjs/mrm-preset": "^5.0.3",
|
|
32
32
|
"@adonisjs/require-ts": "^2.0.13",
|
|
33
|
+
"@eslint/eslintrc": "^2.1.4",
|
|
33
34
|
"@types/node": "^17.0.41",
|
|
34
35
|
"@types/pino-std-serializers": "^4.0.0",
|
|
35
36
|
"@types/uuid": "^9.0.2",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^6.17.0",
|
|
38
|
+
"@typescript-eslint/parser": "^6.17.0",
|
|
39
|
+
"eslint": "^8.56.0",
|
|
40
|
+
"eslint-config-prettier": "^8.5.0",
|
|
41
|
+
"eslint-plugin-prettier": "^5.1.2",
|
|
36
42
|
"mrm": "^4.1.17",
|
|
43
|
+
"prettier": "^3.1.1",
|
|
37
44
|
"typescript": "^4.7.3"
|
|
38
45
|
},
|
|
39
46
|
"mrmConfig": {
|