@geprom/eslint-prettier-sapient 1.0.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/LICENSE +21 -0
- package/README.md +116 -0
- package/index.js +66 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GEPROM
|
|
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,116 @@
|
|
|
1
|
+
# @geprom/eslint-prettier-sapient
|
|
2
|
+
|
|
3
|
+
ESLint and Prettier configuration for Geprom Sapient projects with support for both camelCase and snake_case naming conventions.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @geprom/eslint-prettier-sapient eslint prettier
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Create an `.eslintrc.js` file in your project root:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
module.exports = {
|
|
17
|
+
extends: ['@geprom/eslint-prettier-sapient'],
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Create a `.prettierrc.js` file in your project root:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
module.exports = {
|
|
25
|
+
printWidth: 100,
|
|
26
|
+
singleQuote: true,
|
|
27
|
+
trailingComma: 'es5',
|
|
28
|
+
bracketSpacing: true,
|
|
29
|
+
semi: true,
|
|
30
|
+
useTabs: false,
|
|
31
|
+
tabWidth: 2,
|
|
32
|
+
arrowParens: 'always',
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Add scripts to your `package.json`:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"scripts": {
|
|
41
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
42
|
+
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
|
43
|
+
"format": "prettier --write .",
|
|
44
|
+
"format:check": "prettier --check ."
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
- ✅ Airbnb ESLint ruleset
|
|
52
|
+
- ✅ Prettier integration
|
|
53
|
+
- ✅ Both camelCase and snake_case naming support
|
|
54
|
+
- ✅ Preconfigured globals: `DbCon`, `DbQuery`, `logger`
|
|
55
|
+
|
|
56
|
+
## Configuration Details
|
|
57
|
+
|
|
58
|
+
### Supported Naming Conventions
|
|
59
|
+
|
|
60
|
+
Both naming styles are accepted without warnings:
|
|
61
|
+
|
|
62
|
+
- `someFunction` (camelCase)
|
|
63
|
+
- `some_function` (snake_case)
|
|
64
|
+
|
|
65
|
+
### Application Globals
|
|
66
|
+
|
|
67
|
+
These globals are pre-declared and don't require imports, any additional global variable available in Sapient should :
|
|
68
|
+
|
|
69
|
+
- `DbCon` - Database connection class
|
|
70
|
+
- `DbQuery` - Database query class
|
|
71
|
+
- `logger` - Logger instance
|
|
72
|
+
|
|
73
|
+
To extend with additional globals:
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
module.exports = {
|
|
77
|
+
extends: ['@geprom/eslint-prettier-sapient'],
|
|
78
|
+
globals: {
|
|
79
|
+
myCustomGlobal: 'readonly',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### ESLint Rules
|
|
85
|
+
|
|
86
|
+
- **camelcase**: Flexible naming - accepts both camelCase and snake_case patterns
|
|
87
|
+
- **jsx-a11y/href-no-hash**: Disabled
|
|
88
|
+
- **react/jsx-filename-extension**: Warns for .js files (allows .jsx)
|
|
89
|
+
- **max-len**: 100 character limit with exceptions for comments, URLs, and strings
|
|
90
|
+
- **react/prop-types**: Warning level
|
|
91
|
+
- **no-unused-vars**: Ignores variables starting with underscore
|
|
92
|
+
|
|
93
|
+
### Prettier Options
|
|
94
|
+
|
|
95
|
+
- **printWidth**: 100 characters
|
|
96
|
+
- **singleQuote**: true
|
|
97
|
+
- **trailingComma**: 'es5'
|
|
98
|
+
- **bracketSpacing**: true
|
|
99
|
+
- **semi**: true
|
|
100
|
+
- **useTabs**: false
|
|
101
|
+
- **tabWidth**: 2 spaces
|
|
102
|
+
- **arrowParens**: 'always'
|
|
103
|
+
|
|
104
|
+
## Extending the Configuration
|
|
105
|
+
|
|
106
|
+
You can extend or override rules in your project's `.eslintrc.js`:
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
module.exports = {
|
|
110
|
+
extends: ['@geprom/eslint-prettier-sapient'],
|
|
111
|
+
rules: {
|
|
112
|
+
'max-len': ['warn', { code: 120 }], // Override max line length
|
|
113
|
+
'no-console': 'warn', // Add custom rule
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
```
|
package/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ["airbnb", "plugin:prettier/recommended", "prettier"],
|
|
3
|
+
env: {
|
|
4
|
+
browser: true,
|
|
5
|
+
commonjs: true,
|
|
6
|
+
es6: true,
|
|
7
|
+
jest: true,
|
|
8
|
+
node: true,
|
|
9
|
+
},
|
|
10
|
+
parser: "espree",
|
|
11
|
+
parserOptions: {
|
|
12
|
+
ecmaVersion: 2020,
|
|
13
|
+
sourceType: "module",
|
|
14
|
+
ecmaFeatures: {
|
|
15
|
+
jsx: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
globals: {
|
|
19
|
+
DbCon: "readonly",
|
|
20
|
+
DbQuery: "readonly",
|
|
21
|
+
logger: "readonly",
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
camelcase: [
|
|
25
|
+
"warn",
|
|
26
|
+
{
|
|
27
|
+
properties: "never",
|
|
28
|
+
ignoreDestructuring: true,
|
|
29
|
+
allow: ["^[a-z]+(_[a-z]+)*$", "^[a-zA-Z]+([A-Z][a-z]+)*$"],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
"jsx-a11y/href-no-hash": ["off"],
|
|
33
|
+
"react/jsx-filename-extension": [
|
|
34
|
+
"warn",
|
|
35
|
+
{
|
|
36
|
+
extensions: [".js", ".jsx"],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
"max-len": [
|
|
40
|
+
"warn",
|
|
41
|
+
{
|
|
42
|
+
code: 100,
|
|
43
|
+
tabWidth: 2,
|
|
44
|
+
comments: 100,
|
|
45
|
+
ignoreComments: false,
|
|
46
|
+
ignoreTrailingComments: true,
|
|
47
|
+
ignoreUrls: true,
|
|
48
|
+
ignoreStrings: true,
|
|
49
|
+
ignoreTemplateLiterals: true,
|
|
50
|
+
ignoreRegExpLiterals: true,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
"react/prop-types": [1],
|
|
54
|
+
"no-unused-vars": [
|
|
55
|
+
"warn",
|
|
56
|
+
{
|
|
57
|
+
argsIgnorePattern: "^_",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
settings: {
|
|
62
|
+
react: {
|
|
63
|
+
version: "detect",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geprom/eslint-prettier-sapient",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ESLint and Prettier configuration for Geprom Sapient projects with snake_case and camelCase support",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"eslint",
|
|
8
|
+
"eslintconfig",
|
|
9
|
+
"prettier",
|
|
10
|
+
"airbnb",
|
|
11
|
+
"react",
|
|
12
|
+
"code-style",
|
|
13
|
+
"linter"
|
|
14
|
+
],
|
|
15
|
+
"author": "GEPROM",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"eslint": "^8.0.0",
|
|
19
|
+
"prettier": "^2.8.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"eslint": "^8.0.0",
|
|
23
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
24
|
+
"eslint-config-prettier": "^8.5.0",
|
|
25
|
+
"eslint-plugin-import": "^2.26.0",
|
|
26
|
+
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
27
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
28
|
+
"eslint-plugin-react": "^7.32.0",
|
|
29
|
+
"prettier": "^2.8.0"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/GEPROM/eslint-prettier-geprom-sapient.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/GEPROM/eslint-prettier-geprom-sapient/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/GEPROM/eslint-prettier-geprom-sapient#readme",
|
|
39
|
+
"scripts": {
|
|
40
|
+
"postinstall": "node scripts/update-gitignore.js"
|
|
41
|
+
}
|
|
42
|
+
}
|