@shgysk8zer0/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/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ <!-- markdownlint-disable -->
2
+ # Changelog
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [v1.0.0] - 2024-08-21
11
+
12
+ Initial Release
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Chris Zuber
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,55 @@
1
+ # eslint-config
2
+
3
+ A shared ESLint config
4
+
5
+ [![CodeQL](https://github.com/shgysk8zer0/eslint-config/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/shgysk8zer0/eslint-config/actions/workflows/codeql-analysis.yml)
6
+ ![Node CI](https://github.com/shgysk8zer0/eslint-config/workflows/Node%20CI/badge.svg)
7
+ ![Lint Code Base](https://github.com/shgysk8zer0/eslint-config/workflows/Lint%20Code%20Base/badge.svg)
8
+
9
+ [![GitHub license](https://img.shields.io/github/license/shgysk8zer0/eslint-config.svg)](https://github.com/shgysk8zer0/eslint-config/blob/master/LICENSE)
10
+ [![GitHub last commit](https://img.shields.io/github/last-commit/shgysk8zer0/eslint-config.svg)](https://github.com/shgysk8zer0/eslint-config/commits/master)
11
+ [![GitHub release](https://img.shields.io/github/release/shgysk8zer0/eslint-config?logo=github)](https://github.com/shgysk8zer0/eslint-config/releases)
12
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/shgysk8zer0?logo=github)](https://github.com/sponsors/shgysk8zer0)
13
+
14
+ [![npm](https://img.shields.io/npm/v/@shgysk8zer0/eslint-config)](https://www.npmjs.com/package/@shgysk8zer0/eslint-config)
15
+ ![node-current](https://img.shields.io/node/v/@shgysk8zer0/eslint-config)
16
+ ![npm bundle size gzipped](https://img.shields.io/bundlephobia/minzip/@shgysk8zer0/eslint-config)
17
+ [![npm](https://img.shields.io/npm/dw/@shgysk8zer0/eslint-config?logo=npm)](https://www.npmjs.com/package/@shgysk8zer0/eslint-config)
18
+
19
+ [![GitHub followers](https://img.shields.io/github/followers/shgysk8zer0.svg?style=social)](https://github.com/shgysk8zer0)
20
+ ![GitHub forks](https://img.shields.io/github/forks/shgysk8zer0/eslint-config.svg?style=social)
21
+ ![GitHub stars](https://img.shields.io/github/stars/shgysk8zer0/eslint-config.svg?style=social)
22
+ [![Twitter Follow](https://img.shields.io/twitter/follow/shgysk8zer0.svg?style=social)](https://twitter.com/shgysk8zer0)
23
+
24
+ [![Donate using Liberapay](https://img.shields.io/liberapay/receives/shgysk8zer0.svg?logo=liberapay)](https://liberapay.com/shgysk8zer0/donate "Donate using Liberapay")
25
+ - - -
26
+
27
+ - [Code of Conduct](./.github/CODE_OF_CONDUCT.md)
28
+ - [Contributing](./.github/CONTRIBUTING.md)
29
+ <!-- - [Security Policy](./.github/SECURITY.md) -->
30
+
31
+ ## Purpose
32
+
33
+ This package is just to make configuring ESLint easier by providing preset configs for node & browser.
34
+ It also automatically ignores files listed in `.gitignore`.
35
+
36
+ ## Example
37
+
38
+ ```js
39
+ import { node } from '@shgysk8zer0/eslint-config';
40
+
41
+ export default node();
42
+ ```
43
+
44
+ ## Advanced example
45
+
46
+ ```js
47
+ import { rules } from '@shgyk8zer0/eslint-config/rules.js';
48
+ import { ignoreFile } from '@shgysk8zer0/eslint-config/ignoreFile.js';
49
+ import { languageOptions } from '@shgysk8zer0/eslint-config/languageOptions.js';
50
+
51
+ export default [
52
+ ignoreFile,
53
+ { rules, languageOptions }
54
+ ];
55
+ ```
package/browser.cjs ADDED
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var globals = require('globals');
4
+ var js = require('@eslint/js');
5
+
6
+ const browser$2 = globals.browser;
7
+ globals.node;
8
+
9
+ const browser$1 = {
10
+ ecmaVersion: 'latest',
11
+ sourceType: 'module',
12
+ globals: browser$2,
13
+ };
14
+
15
+ const rules = {
16
+ ...js.configs.recommended.rules,
17
+ 'indent': [2, 'tab', { 'SwitchCase': 1 }],
18
+ 'quotes': [2, 'single'],
19
+ 'semi': [2, 'always'],
20
+ 'no-console': 0,
21
+ 'no-async-promise-executor': 0,
22
+ 'no-prototype-builtins': 0,
23
+ 'no-unused-vars': 'error',
24
+ };
25
+
26
+ var browser = ({ ...config } = {}) => ({ rules, languageOptions: browser$1, ...config });
27
+
28
+ module.exports = browser;
package/browser.js ADDED
@@ -0,0 +1,4 @@
1
+ import { browser as languageOptions} from './languageOptions.js';
2
+ import { rules } from './rules.js';
3
+
4
+ export default ({ ...config } = {}) => ({ rules, languageOptions, ...config });
package/config.cjs ADDED
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ var globals$1 = require('globals');
4
+ var js = require('@eslint/js');
5
+ var compat = require('@eslint/compat');
6
+
7
+ const browser$2 = globals$1.browser;
8
+ const node$2 = globals$1.node;
9
+
10
+ var globals = /*#__PURE__*/Object.freeze({
11
+ __proto__: null,
12
+ browser: browser$2,
13
+ node: node$2
14
+ });
15
+
16
+ const node$1 = {
17
+ ecmaVersion: 'latest',
18
+ sourceType: 'module',
19
+ globals: node$2,
20
+ };
21
+
22
+ const browser$1 = {
23
+ ecmaVersion: 'latest',
24
+ sourceType: 'module',
25
+ globals: browser$2,
26
+ };
27
+
28
+ var languageOptions = /*#__PURE__*/Object.freeze({
29
+ __proto__: null,
30
+ browser: browser$1,
31
+ node: node$1
32
+ });
33
+
34
+ const rules = {
35
+ ...js.configs.recommended.rules,
36
+ 'indent': [2, 'tab', { 'SwitchCase': 1 }],
37
+ 'quotes': [2, 'single'],
38
+ 'semi': [2, 'always'],
39
+ 'no-console': 0,
40
+ 'no-async-promise-executor': 0,
41
+ 'no-prototype-builtins': 0,
42
+ 'no-unused-vars': 'error',
43
+ };
44
+
45
+ var nodeConfig = ({ ...config } = {}) => ({ rules, languageOptions: node$1, ...config });
46
+
47
+ var browserConfig = ({ ...config } = {}) => ({ rules, languageOptions: browser$1, ...config });
48
+
49
+ const ignoreFile = compat.includeIgnoreFile(`${process.cwd()}/.gitignore`);
50
+
51
+ const node = config => [ignoreFile, nodeConfig(config)];
52
+ const browser = config => [ignoreFile, browserConfig(config)];
53
+
54
+ exports.browser = browser;
55
+ exports.browserConfig = browserConfig;
56
+ exports.globals = globals;
57
+ exports.ignoreFile = ignoreFile;
58
+ exports.languageOptions = languageOptions;
59
+ exports.node = node;
60
+ exports.nodeConfig = nodeConfig;
61
+ exports.rules = rules;
package/config.js ADDED
@@ -0,0 +1,10 @@
1
+ import nodeConfig from './node.js';
2
+ import browserConfig from './browser.js';
3
+ import { ignoreFile } from './ignoreFile.js';
4
+
5
+ export { rules } from './rules.js';
6
+ export * as globals from './globals.js';
7
+ export * as languageOptions from './languageOptions.js';
8
+ export const node = config => [ignoreFile, nodeConfig(config)];
9
+ export const browser = config => [ignoreFile, browserConfig(config)];
10
+ export { ignoreFile, nodeConfig, browserConfig };
package/globals.cjs ADDED
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var globals = require('globals');
4
+
5
+ const browser = globals.browser;
6
+ const node = globals.node;
7
+
8
+ exports.browser = browser;
9
+ exports.node = node;
package/globals.js ADDED
@@ -0,0 +1,4 @@
1
+ import globals from 'globals';
2
+
3
+ export const browser = globals.browser;
4
+ export const node = globals.node;
package/ignoreFile.js ADDED
@@ -0,0 +1,3 @@
1
+ import { includeIgnoreFile } from '@eslint/compat';
2
+
3
+ export const ignoreFile = includeIgnoreFile(`${process.cwd()}/.gitignore`);
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var globals = require('globals');
4
+
5
+ const browser$1 = globals.browser;
6
+ const node$1 = globals.node;
7
+
8
+ const node = {
9
+ ecmaVersion: 'latest',
10
+ sourceType: 'module',
11
+ globals: node$1,
12
+ };
13
+
14
+ const browser = {
15
+ ecmaVersion: 'latest',
16
+ sourceType: 'module',
17
+ globals: browser$1,
18
+ };
19
+
20
+ exports.browser = browser;
21
+ exports.node = node;
@@ -0,0 +1,13 @@
1
+ import { node as nodeGlobals, browser as browserGlobals } from './globals.js';
2
+
3
+ export const node = {
4
+ ecmaVersion: 'latest',
5
+ sourceType: 'module',
6
+ globals: nodeGlobals,
7
+ };
8
+
9
+ export const browser = {
10
+ ecmaVersion: 'latest',
11
+ sourceType: 'module',
12
+ globals: browserGlobals,
13
+ };
package/node.cjs ADDED
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var globals = require('globals');
4
+ var js = require('@eslint/js');
5
+
6
+ globals.browser;
7
+ const node$2 = globals.node;
8
+
9
+ const node$1 = {
10
+ ecmaVersion: 'latest',
11
+ sourceType: 'module',
12
+ globals: node$2,
13
+ };
14
+
15
+ const rules = {
16
+ ...js.configs.recommended.rules,
17
+ 'indent': [2, 'tab', { 'SwitchCase': 1 }],
18
+ 'quotes': [2, 'single'],
19
+ 'semi': [2, 'always'],
20
+ 'no-console': 0,
21
+ 'no-async-promise-executor': 0,
22
+ 'no-prototype-builtins': 0,
23
+ 'no-unused-vars': 'error',
24
+ };
25
+
26
+ var node = ({ ...config } = {}) => ({ rules, languageOptions: node$1, ...config });
27
+
28
+ module.exports = node;
package/node.js ADDED
@@ -0,0 +1,4 @@
1
+ import { node as languageOptions} from './languageOptions.js';
2
+ import { rules } from './rules.js';
3
+
4
+ export default ({ ...config } = {}) => ({ rules, languageOptions, ...config });
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@shgysk8zer0/eslint-config",
3
+ "version": "1.0.0",
4
+ "description": " A shared ESLint config",
5
+ "keywords": ["eslint", "eslint-config"],
6
+ "type": "module",
7
+ "main": "./config.cjs",
8
+ "module": "./config.js",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./config.js",
12
+ "require": "./config.cjs"
13
+ },
14
+ "./*.js": {
15
+ "import": "./*.js",
16
+ "require": "./*.cjs"
17
+ },
18
+ "./*.mjs": {
19
+ "import": "./*.js",
20
+ "require": "./*.cjs"
21
+ },
22
+ "./*.cjs": {
23
+ "import": "./*.js",
24
+ "require": "./*.cjs"
25
+ },
26
+ "./*": {
27
+ "import": "./*.js",
28
+ "require": "./*.cjs"
29
+ }
30
+ },
31
+ "engines": {
32
+ "node": ">=18.0.0"
33
+ },
34
+ "private": false,
35
+ "scripts": {
36
+ "test": "npm run lint:js",
37
+ "preversion": "npm test && npm run build",
38
+ "prepare": "npm test && npm run build",
39
+ "lint": "npm run lint:js",
40
+ "lint:js": "eslint -c 'eslint.config.js' .",
41
+ "fix:js": "eslint . --fix",
42
+ "build": "npm run build:js",
43
+ "clean": "rm -f ./*.cjs",
44
+ "build:js": "npm run clean && rollup -c rollup.config.js",
45
+ "create:lock": "npm i --package-lock-only --ignore-scripts --no-audit --no-fund",
46
+ "version:bump": "npm run version:bump:patch",
47
+ "version:bump:patch": "npm version --no-git-tag-version patch && npm run create:lock",
48
+ "version:bump:minor": "npm version --no-git-tag-version minor && npm run create:lock",
49
+ "version:bump:major": "npm version --no-git-tag-version major && npm run create:lock"
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/shgysk8zer0/eslint-config.git"
54
+ },
55
+ "author": "Chris Zuber <admin@kernvalley.us>",
56
+ "license": "MIT",
57
+ "funding": [
58
+ {
59
+ "type": "librepay",
60
+ "url": "https://liberapay.com/shgysk8zer0"
61
+ },
62
+ {
63
+ "type": "github",
64
+ "url": "https://github.com/sponsors/shgysk8zer0"
65
+ }
66
+ ],
67
+ "bugs": {
68
+ "url": "https://github.com/shgysk8zer0/eslint-config/issues"
69
+ },
70
+ "homepage": "https://github.com/shgysk8zer0/eslint-config#readme",
71
+ "dependencies": {
72
+ "@eslint/compat": "^1.1.1",
73
+ "@rollup/plugin-node-resolve": "^15.2.3",
74
+ "eslint": "^9.9.0",
75
+ "rollup": "^4.21.0"
76
+ }
77
+ }
package/rules.cjs ADDED
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var js = require('@eslint/js');
4
+
5
+ const rules = {
6
+ ...js.configs.recommended.rules,
7
+ 'indent': [2, 'tab', { 'SwitchCase': 1 }],
8
+ 'quotes': [2, 'single'],
9
+ 'semi': [2, 'always'],
10
+ 'no-console': 0,
11
+ 'no-async-promise-executor': 0,
12
+ 'no-prototype-builtins': 0,
13
+ 'no-unused-vars': 'error',
14
+ };
15
+
16
+ exports.rules = rules;
package/rules.js ADDED
@@ -0,0 +1,12 @@
1
+ import js from '@eslint/js';
2
+
3
+ export const rules = {
4
+ ...js.configs.recommended.rules,
5
+ 'indent': [2, 'tab', { 'SwitchCase': 1 }],
6
+ 'quotes': [2, 'single'],
7
+ 'semi': [2, 'always'],
8
+ 'no-console': 0,
9
+ 'no-async-promise-executor': 0,
10
+ 'no-prototype-builtins': 0,
11
+ 'no-unused-vars': 'error',
12
+ };