sim-node-lib 0.4.3 → 0.4.4
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 +81 -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,81 @@
|
|
|
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
|
+
const basic = [
|
|
6
|
+
...compat.config({
|
|
7
|
+
plugins: ['@typescript-eslint'],
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
9
|
+
parserOptions: {
|
|
10
|
+
project: true,
|
|
11
|
+
tsconfigRootDir: __dirname,
|
|
12
|
+
},
|
|
13
|
+
ignorePatterns: ['database/**', 'build/**'],
|
|
14
|
+
}),
|
|
15
|
+
{
|
|
16
|
+
files: ['**/*.ts'],
|
|
17
|
+
ignores: ['/database/**/*.ts'],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
sourceType: 'module',
|
|
20
|
+
ecmaVersion: 'latest',
|
|
21
|
+
},
|
|
22
|
+
plugins: { 'sim-eslint': simEslint },
|
|
23
|
+
rules: {
|
|
24
|
+
'sim-eslint/ensure-bindings': 'error',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
eslintPluginPrettierRecommended,
|
|
28
|
+
];
|
|
29
|
+
const recommendedBasic = [
|
|
30
|
+
...compat.config({
|
|
31
|
+
extends: ['plugin:@typescript-eslint/recommended'],
|
|
32
|
+
plugins: ['@typescript-eslint'],
|
|
33
|
+
parser: '@typescript-eslint/parser',
|
|
34
|
+
parserOptions: {
|
|
35
|
+
project: true,
|
|
36
|
+
tsconfigRootDir: __dirname,
|
|
37
|
+
},
|
|
38
|
+
ignorePatterns: ['database/**', 'build/**'],
|
|
39
|
+
}),
|
|
40
|
+
{
|
|
41
|
+
files: ['**/*.ts'],
|
|
42
|
+
ignores: ['/database/**/*.ts'],
|
|
43
|
+
languageOptions: {
|
|
44
|
+
sourceType: 'module',
|
|
45
|
+
ecmaVersion: 'latest',
|
|
46
|
+
},
|
|
47
|
+
plugins: { 'sim-eslint': simEslint },
|
|
48
|
+
rules: {
|
|
49
|
+
'sim-eslint/ensure-bindings': 'error',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
eslintPluginPrettierRecommended,
|
|
53
|
+
];
|
|
54
|
+
const recommendedTypeChecked = [
|
|
55
|
+
...compat.config({
|
|
56
|
+
extends: ['plugin:@typescript-eslint/recommended-type-checked'],
|
|
57
|
+
plugins: ['@typescript-eslint'],
|
|
58
|
+
parser: '@typescript-eslint/parser',
|
|
59
|
+
parserOptions: {
|
|
60
|
+
project: true,
|
|
61
|
+
tsconfigRootDir: __dirname,
|
|
62
|
+
},
|
|
63
|
+
ignorePatterns: ['database/**', 'build/**'],
|
|
64
|
+
}),
|
|
65
|
+
{
|
|
66
|
+
files: ['**/*.ts'],
|
|
67
|
+
ignores: ['/database/**/*.ts'],
|
|
68
|
+
languageOptions: {
|
|
69
|
+
sourceType: 'module',
|
|
70
|
+
ecmaVersion: 'latest',
|
|
71
|
+
},
|
|
72
|
+
plugins: { 'sim-eslint': simEslint },
|
|
73
|
+
rules: {
|
|
74
|
+
'sim-eslint/ensure-bindings': 'error',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
eslintPluginPrettierRecommended,
|
|
78
|
+
];
|
|
79
|
+
module.exports.basic = basic;
|
|
80
|
+
module.exports.recommendedBasic = recommendedBasic;
|
|
81
|
+
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.4",
|
|
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": {
|