@omer-x/eslint-config 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/.eslintrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./base",
3
+ "rules": {
4
+ "no-undef": "off",
5
+ "sort-keys": ["error", "asc", { "caseSensitive": true, "natural": false }]
6
+ }
7
+ }
@@ -0,0 +1,30 @@
1
+ name: Publish Package to NPM
2
+ on:
3
+ release:
4
+ types: [published]
5
+ jobs:
6
+ publish:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - name: Checkout code
10
+ uses: actions/checkout@v4
11
+
12
+ - name: Setup Node.js
13
+ uses: actions/setup-node@v4
14
+ with:
15
+ node-version: 'lts/*'
16
+ registry-url: 'https://registry.npmjs.org'
17
+
18
+ # - name: Install dependencies
19
+ # run: npm install
20
+
21
+ # - name: Run tests
22
+ # run: npm test
23
+
24
+ # - name: Build package
25
+ # run: npm run build
26
+
27
+ - name: Publish to NPM
28
+ run: npm publish
29
+ env:
30
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Omer Mecitoglu
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,35 @@
1
+ # @omer-x/eslint-config
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ This package contains my favorite ESLint rules, created following [this tutorial](https://eslint.org/docs/latest/extend/shareable-configs) on ESLint's shareable configs.
6
+
7
+ ## Installation
8
+
9
+ Install this package via npm:
10
+
11
+ ```bash
12
+ npm install @omer-x/eslint-config --save-dev
13
+ ```
14
+
15
+ Ensure you have the following peer dependencies installed:
16
+
17
+ - `eslint >= 8`
18
+
19
+ ## Usage
20
+
21
+ Add the configuration to your ESLint configuration file (e.g., `.eslintrc.js`):
22
+
23
+ ```javascript
24
+ module.exports = {
25
+ extends: [
26
+ "@omer-x/eslint-config",
27
+ "@omer-x/eslint-config/typescript" // optional
28
+ ],
29
+ // other configurations...
30
+ };
31
+ ```
32
+
33
+ ## License
34
+
35
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
package/base.js ADDED
@@ -0,0 +1,46 @@
1
+ module.exports = {
2
+ extends: [
3
+ "eslint:recommended",
4
+ ],
5
+ rules: {
6
+ "arrow-spacing": ["warn", { "after": true, "before": true }],
7
+ "brace-style": ["error", "1tbs"],
8
+ "comma-dangle": ["error", "always-multiline"],
9
+ "comma-spacing": "error",
10
+ "comma-style": "error",
11
+ "curly": ["error", "multi-line", "consistent"],
12
+ "dot-location": ["error", "property"],
13
+ "handle-callback-err": "off",
14
+ "indent": ["error", 2, { "SwitchCase": 1 }],
15
+ "keyword-spacing": "error",
16
+ "max-nested-callbacks": ["error", { "max": 4 }],
17
+ "max-statements-per-line": ["error", { "max": 2 }],
18
+ "no-console": "off",
19
+ "no-duplicate-imports": "error",
20
+ "no-empty-function": "error",
21
+ "no-floating-decimal": "error",
22
+ "no-inline-comments": "error",
23
+ "no-lonely-if": "error",
24
+ "no-multi-spaces": "error",
25
+ "no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 0, "maxEOF": 1 }],
26
+ "no-shadow": ["error", { "allow": ["err", "resolve", "reject"] }],
27
+ "no-trailing-spaces": ["error"],
28
+ "no-var": "error",
29
+ "object-curly-spacing": ["error", "always"],
30
+ "prefer-const": "error",
31
+ "quotes": ["error", "double"],
32
+ "semi": ["error", "always"],
33
+ "sort-imports": ["error", { "ignoreDeclarationSort": true }],
34
+ "space-before-blocks": "error",
35
+ "space-before-function-paren": ["error", {
36
+ "anonymous": "never",
37
+ "asyncArrow": "always",
38
+ "named": "never",
39
+ }],
40
+ "space-in-parens": "error",
41
+ "space-infix-ops": "error",
42
+ "space-unary-ops": "error",
43
+ "spaced-comment": "error",
44
+ "yoda": "error",
45
+ },
46
+ };
package/index.js ADDED
@@ -0,0 +1,29 @@
1
+ module.exports = {
2
+ extends: [
3
+ "./base",
4
+ ],
5
+ plugins: [
6
+ "import",
7
+ "unused-imports",
8
+ ],
9
+ rules: {
10
+ "import/order": [
11
+ "error",
12
+ {
13
+ "alphabetize": {
14
+ "caseInsensitive": false,
15
+ "order": "asc",
16
+ },
17
+ "groups": ["builtin", "external", "internal", "parent", "sibling", "index", "type", "object"],
18
+ "pathGroups": [
19
+ { "group": "internal", "pattern": "~/**" },
20
+ ],
21
+ },
22
+ ],
23
+ "unused-imports/no-unused-imports": "error",
24
+ "unused-imports/no-unused-vars": [
25
+ "warn",
26
+ { "args": "after-used", "argsIgnorePattern": "^_", "vars": "all", "varsIgnorePattern": "^_" },
27
+ ],
28
+ },
29
+ };
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@omer-x/eslint-config",
3
+ "version": "1.0.0",
4
+ "description": "My favorite eslint rules",
5
+ "author": "Omer Mecitoglu",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "eslint",
9
+ "config"
10
+ ],
11
+ "private": false,
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "main": "index.js",
16
+ "scripts": {
17
+ "lint": "eslint"
18
+ },
19
+ "peerDependencies": {
20
+ "eslint": ">= 8"
21
+ },
22
+ "dependencies": {
23
+ "@typescript-eslint/eslint-plugin": "^6.17.0",
24
+ "eslint-plugin-import": "^2.29.1",
25
+ "eslint-plugin-unused-imports": "^3.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "eslint": "^8.56.0"
29
+ }
30
+ }
package/typescript.js ADDED
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ extends: [
3
+ "plugin:@typescript-eslint/recommended",
4
+ ],
5
+ plugins: [
6
+ "@typescript-eslint",
7
+ ],
8
+ rules: {
9
+ "@typescript-eslint/ban-ts-ignore": "off",
10
+ "@typescript-eslint/member-delimiter-style": ["error", {
11
+ "multiline": { "delimiter": "comma", "requireLast": true },
12
+ "multilineDetection": "brackets",
13
+ "singleline": { "delimiter": "comma", "requireLast": false },
14
+ }],
15
+ "@typescript-eslint/no-unnecessary-condition": "error",
16
+ "@typescript-eslint/no-unused-vars": "off",
17
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
18
+ "@typescript-eslint/semi": ["error", "always"],
19
+ },
20
+ };