@imagexmedia/eslint 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
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 @@
1
+ # SWAT ESLint
@@ -0,0 +1,3 @@
1
+ import { setConfig } from '@imagexmedia/eslint'
2
+
3
+ export default setConfig()
@@ -0,0 +1,53 @@
1
+ interface EslintOptions {
2
+ toggles?: {
3
+ /**
4
+ * Enable HTML formatter support. Enabled by default.
5
+ */
6
+ html?: boolean;
7
+ /**
8
+ * Enable JSONC linter support. Enabled by default.
9
+ */
10
+ jsonc?: boolean;
11
+ /**
12
+ * Enable JSX linter support. Disabled by default.
13
+ */
14
+ jsx?: boolean;
15
+ /**
16
+ * Enable Markdown formatter support. Enabled by default.
17
+ */
18
+ markdown?: boolean;
19
+ /**
20
+ * Enable React support. Disabled by default.
21
+ */
22
+ react?: boolean;
23
+ /**
24
+ * Enable SVG formatter support. Enabled by default.
25
+ */
26
+ svg?: boolean;
27
+ /**
28
+ * Enable TOML linter support. Enabled by default.
29
+ */
30
+ toml?: boolean;
31
+ /**
32
+ * Enable TypeScript support. Enabled by default.
33
+ */
34
+ typescript?: boolean;
35
+ /**
36
+ * Enable XML formatter support. Enabled by default.
37
+ */
38
+ xml?: boolean;
39
+ /**
40
+ * Enable Yaml linter support. Enabled by default.
41
+ */
42
+ yaml?: boolean;
43
+ };
44
+ /**
45
+ * An array of additional files or globs to ignore.
46
+ */
47
+ ignores?: string[];
48
+ }
49
+ /**
50
+ * Define ESLint configuration.
51
+ */
52
+ export declare function setConfig(options?: EslintOptions): import("eslint-flat-config-utils").FlatConfigComposer<import("@antfu/eslint-config").TypedFlatConfigItem, import("@antfu/eslint-config").ConfigNames>;
53
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ import antfu, { GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX } from '@antfu/eslint-config';
2
+ import merge from 'deepmerge';
3
+ /**
4
+ * Define ESLint configuration.
5
+ */
6
+ export function setConfig(options = {}) {
7
+ options = merge({
8
+ toggles: {
9
+ html: true,
10
+ jsonc: true,
11
+ jsx: false,
12
+ markdown: true,
13
+ react: false,
14
+ svg: true,
15
+ toml: true,
16
+ typescript: true,
17
+ xml: true,
18
+ yaml: true,
19
+ },
20
+ ignores: [],
21
+ }, options);
22
+ return antfu({
23
+ jsonc: options.toggles.jsonc,
24
+ jsx: options.toggles.jsx,
25
+ react: options.toggles.react,
26
+ toml: options.toggles.toml,
27
+ typescript: options.toggles.typescript,
28
+ yaml: options.toggles.yaml,
29
+ formatters: {
30
+ html: options.toggles.html,
31
+ markdown: options.toggles.markdown,
32
+ svg: options.toggles.svg,
33
+ xml: options.toggles.xml,
34
+ prettierOptions: { printWidth: 240 },
35
+ },
36
+ ignores: [...new Set([
37
+ '**/.ddev/',
38
+ '**/.docksal/',
39
+ '**/.lando/',
40
+ '**/config/',
41
+ '**/default.*',
42
+ '**/local.*',
43
+ ...options.ignores,
44
+ ])],
45
+ rules: {
46
+ 'no-alert': 'off',
47
+ 'no-console': 'off',
48
+ 'no-undef': 'off',
49
+ 'antfu/no-top-level-await': 'off',
50
+ },
51
+ }, {
52
+ name: '@imagexmedia/eslint',
53
+ files: [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
54
+ rules: {
55
+ 'style/array-bracket-newline': ['error', 'consistent'],
56
+ 'style/lines-between-class-members': ['error', {
57
+ enforce: [{
58
+ blankLine: 'always',
59
+ prev: '*',
60
+ next: 'method',
61
+ }],
62
+ }],
63
+ 'style/max-len': ['error', {
64
+ code: 240,
65
+ comments: 120,
66
+ ignoreRegExpLiterals: true,
67
+ ignoreStrings: true,
68
+ ignoreTemplateLiterals: true,
69
+ ignoreUrls: true,
70
+ }],
71
+ 'style/multiline-comment-style': ['error', 'separate-lines'],
72
+ 'style/object-curly-newline': ['error', { consistent: true }],
73
+ 'ts/no-namespace': ['error', { allowDeclarations: true }],
74
+ },
75
+ })
76
+ .override('antfu/perfectionist/setup', (config) => {
77
+ // @ts-expect-error Allow sorted imports to be grouped by newline.
78
+ config.rules['perfectionist/sort-imports'][1].partitionByNewLine = true;
79
+ return config;
80
+ })
81
+ .override('antfu/yaml/rules', {
82
+ rules: {
83
+ 'yml/flow-mapping-curly-spacing': ['error', 'always'],
84
+ },
85
+ });
86
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@imagexmedia/eslint",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "description": "The ImageX SWAT ESLint package.",
6
+ "author": "ImageX Media",
7
+ "license": "MIT",
8
+ "exports": {
9
+ ".": "./dist/index.js"
10
+ },
11
+ "main": "dist/index.js",
12
+ "types": "dist/index.d.ts",
13
+ "files": [
14
+ "LICENSE",
15
+ "README.md",
16
+ "configs",
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "rm -rf dist && tsc -b && mkdir -p packs && npm pack --pack-destination packs"
21
+ },
22
+ "peerDependencies": {
23
+ "@antfu/eslint-config": "^5.4.1",
24
+ "@eslint-react/eslint-plugin": "^1.53.1",
25
+ "@eslint/compat": "^1.4.1",
26
+ "@prettier/plugin-xml": "^3.4.2",
27
+ "deepmerge": "^4.3.1",
28
+ "eslint": "^9.39.1",
29
+ "eslint-plugin-format": "^1.1.0",
30
+ "eslint-plugin-react-hooks": "^5.2.0",
31
+ "eslint-plugin-react-refresh": "^0.4.24"
32
+ }
33
+ }