@brybrant/eslint-config 0.0.1

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.
@@ -0,0 +1,20 @@
1
+ import { Linter } from "eslint";
2
+
3
+ //#region packages/eslint/eslint.config.d.ts
4
+ /**
5
+ * ## ESLint Config Function
6
+ *
7
+ * Ignores all files in the `dist` folder within the current working directory.
8
+ *
9
+ * ### Configs:
10
+ * 1. [Recommended JS ESLint config](https://www.npmjs.com/@eslint/js)
11
+ * 2. {@link tseslintConfig my TS ESLint config}
12
+ * 3. **ESLint config object(s)** *(rest parameter)*
13
+ * 4. [my Prettier config](https://www.npmjs.com/@brybrant/prettier-config)
14
+ * 5. {@link jsdocConfigs JSDoc ESLint config}
15
+ *
16
+ * @param configs - [ESLint config object(s)](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects)
17
+ */
18
+ declare function export_default(...configs: Linter.Config[]): Linter.Config[];
19
+ //#endregion
20
+ export { export_default as default };
@@ -0,0 +1,102 @@
1
+ import { defineConfig, globalIgnores } from "eslint/config";
2
+ import globals from "globals";
3
+ import js from "@eslint/js";
4
+ import { jsdoc } from "eslint-plugin-jsdoc";
5
+ import eslintPluginPrettier from "eslint-plugin-prettier/recommended";
6
+ import tseslint from "typescript-eslint";
7
+ //#region packages/prettier/prettier.config.mjs
8
+ /**
9
+ * ### Prettier Config Object
10
+ *
11
+ * https://prettier.io/docs/en/options
12
+ */
13
+ const prettierConfig = {
14
+ bracketSameLine: false,
15
+ bracketSpacing: true,
16
+ endOfLine: "auto",
17
+ singleQuote: true,
18
+ jsxSingleQuote: true
19
+ };
20
+ //#endregion
21
+ //#region packages/eslint/eslint.config.ts
22
+ const tseslintConfig = {
23
+ files: ["./**/*.{ts,tsx,cts,mts}"],
24
+ plugins: { "@typescript-eslint": tseslint.plugin },
25
+ languageOptions: {
26
+ parser: tseslint.parser,
27
+ globals: globals.nodeBuiltin,
28
+ parserOptions: {
29
+ projectService: true,
30
+ tsconfigRootDir: import.meta.dirname
31
+ }
32
+ },
33
+ rules: tseslint.configs.strictTypeChecked.reduce((rules, config) => Object.assign(rules, config.rules ?? {}), {})
34
+ };
35
+ const jsdocSettings = { tagNamePreference: {
36
+ property: "prop",
37
+ augments: "extends"
38
+ } };
39
+ /** https://github.com/gajus/eslint-plugin-jsdoc#configuration */
40
+ const jsdocConfigs = [jsdoc({
41
+ files: ["./**/*.{js,jsx,cjs,mjs}"],
42
+ config: "flat/recommended-typescript-flavor",
43
+ rules: {
44
+ "jsdoc/check-indentation": 1,
45
+ "jsdoc/check-syntax": 1,
46
+ "jsdoc/no-blank-block-descriptions": 1,
47
+ "jsdoc/no-blank-blocks": 1,
48
+ "jsdoc/no-defaults": 1,
49
+ "jsdoc/no-multi-asterisks": [1, { "allowWhitespace": true }],
50
+ "jsdoc/require-asterisk-prefix": 1,
51
+ "jsdoc/require-param-description": 0,
52
+ "jsdoc/require-property-description": 0,
53
+ "jsdoc/require-returns": 0
54
+ },
55
+ settings: jsdocSettings
56
+ }), jsdoc({
57
+ files: ["./**/*.{ts,tsx,cts,mts}"],
58
+ config: "flat/recommended-typescript",
59
+ rules: {
60
+ "jsdoc/check-indentation": 1,
61
+ "jsdoc/check-syntax": 1,
62
+ "jsdoc/no-blank-block-descriptions": 1,
63
+ "jsdoc/no-blank-blocks": 1,
64
+ "jsdoc/no-defaults": 1,
65
+ "jsdoc/no-multi-asterisks": [1, { "allowWhitespace": true }],
66
+ "jsdoc/require-asterisk-prefix": 1
67
+ },
68
+ settings: jsdocSettings
69
+ })];
70
+ /**
71
+ * ## ESLint Config Function
72
+ *
73
+ * Ignores all files in the `dist` folder within the current working directory.
74
+ *
75
+ * ### Configs:
76
+ * 1. [Recommended JS ESLint config](https://www.npmjs.com/@eslint/js)
77
+ * 2. {@link tseslintConfig my TS ESLint config}
78
+ * 3. **ESLint config object(s)** *(rest parameter)*
79
+ * 4. [my Prettier config](https://www.npmjs.com/@brybrant/prettier-config)
80
+ * 5. {@link jsdocConfigs JSDoc ESLint config}
81
+ *
82
+ * @param configs - [ESLint config object(s)](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects)
83
+ */
84
+ function eslint_config_default(...configs) {
85
+ return defineConfig([
86
+ globalIgnores(["./dist/**/*"]),
87
+ js.configs.recommended,
88
+ tseslintConfig,
89
+ ...configs,
90
+ {
91
+ files: ["./**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}"],
92
+ plugins: eslintPluginPrettier.plugins,
93
+ rules: {
94
+ ...eslintPluginPrettier.rules,
95
+ "prettier/prettier": ["error", prettierConfig]
96
+ }
97
+ },
98
+ ...jsdocConfigs
99
+ ]);
100
+ }
101
+ //#endregion
102
+ export { eslint_config_default as default };
@@ -0,0 +1,109 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { RulesConfig } from '@eslint/core';
3
+
4
+ import { defineConfig, globalIgnores } from 'eslint/config';
5
+ import globals from 'globals';
6
+ import js from '@eslint/js';
7
+ import { jsdoc } from 'eslint-plugin-jsdoc';
8
+ import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
9
+ import tseslint from 'typescript-eslint';
10
+
11
+ import prettierConfig from '@brybrant/prettier-config';
12
+
13
+ const tseslintConfig: Linter.Config = {
14
+ files: ['./**/*.{ts,tsx,cts,mts}'],
15
+ plugins: {
16
+ '@typescript-eslint': tseslint.plugin,
17
+ },
18
+ languageOptions: {
19
+ parser: tseslint.parser,
20
+ globals: globals.nodeBuiltin,
21
+ /** https://typescript-eslint.io/packages/parser */
22
+ parserOptions: {
23
+ /** Required for rules which need type information */
24
+ projectService: true,
25
+ /** Root directory for relative TSConfig paths */
26
+ tsconfigRootDir: import.meta.dirname,
27
+ },
28
+ },
29
+ rules: tseslint.configs.strictTypeChecked.reduce(
30
+ (rules, config) => Object.assign(rules, config.rules ?? {}),
31
+ {},
32
+ ) as RulesConfig,
33
+ };
34
+
35
+ const jsdocSettings = {
36
+ tagNamePreference: {
37
+ property: 'prop',
38
+ augments: 'extends',
39
+ },
40
+ };
41
+
42
+ /** https://github.com/gajus/eslint-plugin-jsdoc#configuration */
43
+ const jsdocConfigs = [
44
+ /** JavaScript */
45
+ jsdoc({
46
+ files: ['./**/*.{js,jsx,cjs,mjs}'],
47
+ config: 'flat/recommended-typescript-flavor',
48
+ rules: {
49
+ 'jsdoc/check-indentation': 1,
50
+ 'jsdoc/check-syntax': 1,
51
+ 'jsdoc/no-blank-block-descriptions': 1,
52
+ 'jsdoc/no-blank-blocks': 1,
53
+ 'jsdoc/no-defaults': 1,
54
+ 'jsdoc/no-multi-asterisks': [1, { 'allowWhitespace': true }],
55
+ 'jsdoc/require-asterisk-prefix': 1,
56
+ 'jsdoc/require-param-description': 0,
57
+ 'jsdoc/require-property-description': 0,
58
+ 'jsdoc/require-returns': 0,
59
+ },
60
+ settings: jsdocSettings,
61
+ }),
62
+ /** TypeScript */
63
+ jsdoc({
64
+ files: ['./**/*.{ts,tsx,cts,mts}'],
65
+ config: 'flat/recommended-typescript',
66
+ rules: {
67
+ 'jsdoc/check-indentation': 1,
68
+ 'jsdoc/check-syntax': 1,
69
+ 'jsdoc/no-blank-block-descriptions': 1,
70
+ 'jsdoc/no-blank-blocks': 1,
71
+ 'jsdoc/no-defaults': 1,
72
+ 'jsdoc/no-multi-asterisks': [1, { 'allowWhitespace': true }],
73
+ 'jsdoc/require-asterisk-prefix': 1,
74
+ },
75
+ settings: jsdocSettings,
76
+ }),
77
+ ];
78
+
79
+ /**
80
+ * ## ESLint Config Function
81
+ *
82
+ * Ignores all files in the `dist` folder within the current working directory.
83
+ *
84
+ * ### Configs:
85
+ * 1. [Recommended JS ESLint config](https://www.npmjs.com/@eslint/js)
86
+ * 2. {@link tseslintConfig my TS ESLint config}
87
+ * 3. **ESLint config object(s)** *(rest parameter)*
88
+ * 4. [my Prettier config](https://www.npmjs.com/@brybrant/prettier-config)
89
+ * 5. {@link jsdocConfigs JSDoc ESLint config}
90
+ *
91
+ * @param configs - [ESLint config object(s)](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects)
92
+ */
93
+ export default function(...configs: Linter.Config[]): Linter.Config[] {
94
+ return defineConfig([
95
+ globalIgnores(['./dist/**/*']),
96
+ js.configs.recommended,
97
+ tseslintConfig,
98
+ ...configs,
99
+ {
100
+ files: ['./**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}'],
101
+ plugins: eslintPluginPrettier.plugins,
102
+ rules: {
103
+ ...eslintPluginPrettier.rules,
104
+ 'prettier/prettier': ['error', prettierConfig],
105
+ },
106
+ },
107
+ ...jsdocConfigs,
108
+ ]);
109
+ };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@brybrant/eslint-config",
3
+ "author": "brybrant",
4
+ "license": "GPL-3.0-only",
5
+ "version": "0.0.1",
6
+ "type": "module",
7
+ "module": "./eslint.config.js",
8
+ "types": "./eslint.config.d.ts",
9
+ "exports": "./eslint.config.js",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/brybrant/configs.git"
13
+ },
14
+ "dependencies": {
15
+ "@brybrant/prettier-config": "^0.0.1",
16
+ "@types/node": "^22.19.15",
17
+ "eslint": "^9.39.4",
18
+ "eslint-config-prettier": "^10.1.8",
19
+ "eslint-plugin-jsdoc": "^62.8.1",
20
+ "eslint-plugin-prettier": "^5.5.5",
21
+ "globals": "^17.4.0",
22
+ "prettier": "^3.8.1",
23
+ "typescript-eslint": "^8.58.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/eslint": "^9.6.1",
27
+ "typescript": "^5.9.3"
28
+ }
29
+ }