@1stg/eslint-config 11.1.0 → 12.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/CHANGELOG.md CHANGED
@@ -1,5 +1,75 @@
1
1
  # Change Log
2
2
 
3
+ ## 12.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#436](https://github.com/1stG/configs/pull/436) [`ac965ca`](https://github.com/1stG/configs/commit/ac965ca37c90f140ed42aa6d93ceb4154886e167) Thanks [@JounQin](https://github.com/JounQin)! - Import `eslint-plugin-oxlint` statically and always apply its disable list.
8
+ The `oxlint: false` option is removed because omitting Oxlint would silently
9
+ skip those checks; Oxlint itself remains required through the plugin peer.
10
+
11
+ ## 12.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - [#415](https://github.com/1stG/configs/pull/415) [`a0276d4`](https://github.com/1stG/configs/commit/a0276d4bc5f6cbac18c01ee90945631375e0f851) Thanks [@JounQin](https://github.com/JounQin)! - feat!: defineConfig-based configs, Oxlint/Oxfmt and a thin ESLint
16
+
17
+ Every remaining config package now exports a `defineConfig(options)` factory
18
+ alongside the zero-config default. Options are explicit: the configs no longer
19
+ rely on ambient `CI`, `NODE_ENV`, `cwd` or git state; defaults may detect the
20
+ project structure or installed optional peers when `defineConfig()` is called.
21
+ Options extend the native config types (`OxfmtConfig`, `OxlintConfig`,
22
+ `prettier.Config`, `stylelint.Config`, `postcss.ProcessOptions`, ...), so
23
+ tool-specific fields pass through without being re-declared.
24
+
25
+ - `@1stg/eslint-config` now only covers the file types Oxlint cannot parse
26
+ (Markdown/JSON/YAML/TOML) and uses `eslint-plugin-oxlint` to avoid duplicate
27
+ reports; Markdown/JSON(C) and `eslint-plugin-oxlint` are installed by default,
28
+ YAML/TOML are optional peers, and `eslint-plugin-markup` can lint HTML on
29
+ Node >= 24 when installed.
30
+ `@1stg/babel-preset` is removed and JS/TS/Vue parsing moves to
31
+ [`@1stg/oxlint-config`](../packages/oxlint-config).
32
+ - New [`@1stg/oxlint-config`](../packages/oxlint-config) (Oxlint) and
33
+ [`@1stg/oxfmt-config`](../packages/oxfmt-config) (Oxfmt). Framework plugins are
34
+ enabled when the framework is installed; formatting is no longer an ESLint
35
+ rule by default.
36
+ - `@1stg/prettier-config` is kept for the languages Oxfmt cannot format (Pug,
37
+ Ruby, shell, INI, properties, Stylus, Sass). Its plugins are optional peer
38
+ dependencies (discovered from this package's `dependencies` + optional
39
+ `peerDependencies`), with `prettier-plugin-pkg` installed by default; the
40
+ `/next` (`babel-ts`) variant is gone with Babel.
41
+ - `@1stg/nano-staged` takes `formatter` (`'oxfmt' | 'prettier' | 'both'`),
42
+ `linter` (`'oxlint' | 'eslint'`) and `typecheck` options instead of
43
+ per-framework entry points (`/tsc`, `/ngc`, `/vue-tsc`). Linter, stylelint,
44
+ type-coverage and imagemin are auto-detected from installed packages.
45
+ - `@1stg/stylelint-config` takes `scss`, `scssLoose`, `modules` and `prettier`
46
+ options; `stylelint-prettier` is an optional peer enabled when installed, and
47
+ `vue` is enabled when `vue` is installed.
48
+ - `@1stg/markuplint-config` takes `vue` instead of the `/angular` and `/vue`
49
+ subpaths. Angular support is dropped, including the `@1stg/tsconfig/angular`
50
+ and `ng-lib` presets.
51
+ - `@1stg/commitlint-config` takes `monorepo` (defaulting to `isMonorepo()`);
52
+ `@1stg/simple-git-hooks` takes `runner` and only emits hooks for installed
53
+ `nano-staged`/`@commitlint/cli`.
54
+ - `@1stg/postcss-config` is ESM only (use `postcss.config.js`), minifies based
55
+ on its `env` option rather than a module-level `NODE_ENV` snapshot, and extends
56
+ `postcss.ProcessOptions`; accepts `minify`, `map`, `cssnano`, `presetOptions`
57
+ and extra `plugins`.
58
+ - All packages are authored in TypeScript and built with `tsc -b` into `lib/`;
59
+ declarations are generated, the hand-written `.d.ts` files are gone, and
60
+ `yarn build` runs on install and release.
61
+ - All packages publish explicit `exports.types`, a `files` allow-list, and
62
+ consistent Node.js engines.
63
+ - `@1stg/browserslist-config` is ESM only (browserslist >= 4.24.5) and drops
64
+ the `alauda` and `alauda-legacy` presets.
65
+
66
+ ### Minor Changes
67
+
68
+ - [#421](https://github.com/1stG/configs/pull/421) [`e3b113d`](https://github.com/1stG/configs/commit/e3b113d17a63c9d8b85a7d955c6128a4c4cf08cd) Thanks [@JounQin](https://github.com/JounQin)! - Add a `code` mode that lints JS/TS/JSX with `typescript-eslint` and
69
+ optional `eslint-plugin-regexp` / `eslint-plugin-sonarjs`, while `eslint-plugin-oxlint` keeps rules
70
+ already covered by Oxlint disabled. It is enabled automatically when `typescript-eslint` is installed; pass
71
+ `code: false` to disable it.
72
+
3
73
  ## 11.1.0
4
74
 
5
75
  ### Minor Changes
package/README.md CHANGED
@@ -1,6 +1,66 @@
1
1
  # @1stg/eslint-config
2
2
 
3
- Personal but Shareable ESLint Configuration for all 1stG.me projects
3
+ ESLint is kept for the file types Oxlint cannot parse:
4
+
5
+ - Markdown/MDX (`eslint-plugin-mdx`)
6
+ - JSON/JSONC/JSON5 (`eslint-plugin-jsonc`)
7
+ - YAML (`eslint-plugin-yml`)
8
+ - TOML (`eslint-plugin-toml`)
9
+
10
+ JS/TS/JSX/Vue are owned by `@1stg/oxlint-config`. When `typescript-eslint` is
11
+ installed, `code` mode is enabled automatically and additionally lints
12
+ JS/TS/JSX with `typescript-eslint` plus optional `eslint-plugin-regexp` /
13
+ `eslint-plugin-sonarjs`, while `eslint-plugin-oxlint` disables every rule
14
+ Oxlint already covers. Pass `code: false` to keep the thin file-type-only
15
+ behavior. Vue templates remain with Oxlint/markuplint.
16
+
17
+ ## Usage
18
+
19
+ ```js
20
+ // eslint.config.js
21
+ import { defineConfig } from '@1stg/eslint-config'
22
+
23
+ export default defineConfig()
24
+ ```
25
+
26
+ `eslint-plugin-mdx`, `eslint-plugin-jsonc` and `eslint-plugin-oxlint` are
27
+ installed by default, so Markdown/JSON(C) linting and the Oxlint rule-disable
28
+ list are on. `eslint-plugin-oxlint` in turn requires `oxlint`. `eslint-plugin-yml` and `eslint-plugin-toml` are optional peers,
29
+ enabled only when installed (`import.meta.resolve`). ESLint awaits the returned promise. Use
30
+ `export default await defineConfig()` if your tool does not await it.
31
+
32
+ `eslint-plugin-markup` is an optional peer: when installed on Node >= 24,
33
+ `markup` is enabled by default and `**/*.html` is no longer ignored. The
34
+ default ignores skip code owned by Oxlint (`.js/.ts/.jsx/.tsx/.vue`), styles
35
+ owned by Stylelint, HTML owned by markuplint, lockfiles and build output.
36
+ `code` defaults to whether `typescript-eslint` is installed. Setting
37
+ `code: true` requires `typescript-eslint` to be installed and throws otherwise;
38
+ `code: false` disables it. Run ESLint only on the non-code extensions when
39
+ code mode is off:
40
+
41
+ ```sh
42
+ eslint "**/*.{md,mdx,json,jsonc,json5,yaml,yml,toml}"
43
+ ```
44
+
45
+ The default export can be re-exported directly:
46
+
47
+ ```js
48
+ export { default } from '@1stg/eslint-config'
49
+ ```
50
+
51
+ Use `defineConfig` only when you need options.
52
+
53
+ ## Options
54
+
55
+ | Option | Default | Description |
56
+ | ---------- | ----------------------------- | ------------------------------------------------------------------- |
57
+ | `markdown` | `true` | Lint Markdown/MDX. |
58
+ | `jsonc` | `true` | Lint JSON/JSONC/JSON5. |
59
+ | `yaml` | installed | Lint YAML when installed. |
60
+ | `toml` | installed | Lint TOML when installed. |
61
+ | `code` | installed `typescript-eslint` | Lint JS/TS/JSX with rules Oxlint does not cover. |
62
+ | `markup` | auto | Lint HTML with `eslint-plugin-markup` on Node >= 24 when installed. |
63
+ | `ignores` | `[]` | Extra ignore patterns. |
4
64
 
5
65
  ## Sponsors and Backers
6
66
 
package/lib/index.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import type { Linter } from 'eslint';
2
+ export interface EslintConfigOptions {
3
+ markdown?: boolean;
4
+ jsonc?: boolean;
5
+ yaml?: boolean;
6
+ toml?: boolean;
7
+ markup?: boolean;
8
+ code?: boolean;
9
+ ignores?: string[];
10
+ }
11
+ export declare const defineConfig: ({ markdown, jsonc: jsoncEnabled, yaml, toml: tomlEnabled, code, markup, ignores, }?: EslintConfigOptions) => Promise<Linter.Config[]>;
12
+ declare const _default: Promise<Linter.Config<import("@eslint/core").RulesConfig>[]>;
13
+ export default _default;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAGpC,MAAM,WAAW,mBAAmB;IAElC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AA6ED,eAAO,MAAM,YAAY,wFAQtB,mBAAmB,KAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CA0EpD,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,106 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
11
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
12
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
13
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
14
+ });
15
+ }
16
+ return path;
17
+ };
18
+ import oxlint from 'eslint-plugin-oxlint';
19
+ const NODE_MAJOR = Number(process.versions.node.split('.')[0]);
20
+ const supportsMarkup = NODE_MAJOR >= 24;
21
+ const CODE_IGNORES = '**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}';
22
+ const DEFAULT_IGNORES = [
23
+ '**/.dsh/**',
24
+ '**/.history/**',
25
+ '**/.type-coverage/**',
26
+ '**/.vercel/**',
27
+ '**/.yarn/**',
28
+ '**/.pnp.*',
29
+ '**/coverage/**',
30
+ '**/dist/**',
31
+ '**/lib/**',
32
+ '**/node_modules/**',
33
+ '**/CHANGELOG.md',
34
+ '**/yarn.lock',
35
+ '**/package-lock.json',
36
+ '**/pnpm-lock.yaml',
37
+ '**/auto-imports.d.ts',
38
+ '**/*.log',
39
+ '**/*.patch',
40
+ '**/*.min.*',
41
+ CODE_IGNORES,
42
+ '**/*.vue',
43
+ '**/*.{css,less,sass,scss,styl,stylus}',
44
+ '**/*.html',
45
+ ];
46
+ const toConfigs = (config) => Array.isArray(config) ? config : [config];
47
+ const withCodeFiles = (config) => { var _a; return (Object.assign(Object.assign({}, config), { files: (_a = config.files) !== null && _a !== void 0 ? _a : [CODE_IGNORES] })); };
48
+ const isInstalled = (name) => {
49
+ try {
50
+ return Boolean(import.meta.resolve(name));
51
+ }
52
+ catch (_a) {
53
+ return false;
54
+ }
55
+ };
56
+ const load = (name) => __awaiter(void 0, void 0, void 0, function* () {
57
+ var _a;
58
+ const mod = (yield import(__rewriteRelativeImportExtension(name, true)));
59
+ return ((_a = mod.default) !== null && _a !== void 0 ? _a : mod);
60
+ });
61
+ export const defineConfig = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* ({ markdown = true, jsonc: jsoncEnabled = true, yaml = isInstalled('eslint-plugin-yml'), toml: tomlEnabled = isInstalled('eslint-plugin-toml'), code = isInstalled('typescript-eslint'), markup = supportsMarkup && isInstalled('eslint-plugin-markup'), ignores = [], } = {}) {
62
+ const defaultIgnores = DEFAULT_IGNORES.filter(pattern => (!markup || pattern !== '**/*.html') && (!code || pattern !== CODE_IGNORES));
63
+ const configs = [{ ignores: [...defaultIgnores, ...ignores] }];
64
+ if (markup) {
65
+ if (!supportsMarkup) {
66
+ throw new Error('@1stg/eslint-config: `markup` requires Node.js >= 24 (eslint-plugin-markup@2)');
67
+ }
68
+ const markupPlugin = yield load('eslint-plugin-markup');
69
+ configs.push(markupPlugin.configs.flatRecommended);
70
+ }
71
+ if (code) {
72
+ if (!isInstalled('typescript-eslint')) {
73
+ throw new Error('@1stg/eslint-config: `code` requires the `typescript-eslint` package');
74
+ }
75
+ const tseslint = yield load('typescript-eslint');
76
+ configs.push(...tseslint.configs.recommended.map(withCodeFiles));
77
+ if (isInstalled('eslint-plugin-sonarjs')) {
78
+ const sonarjs = yield load('eslint-plugin-sonarjs');
79
+ configs.push(...toConfigs(sonarjs.configs.recommended).map(withCodeFiles));
80
+ }
81
+ if (isInstalled('eslint-plugin-regexp')) {
82
+ const regexp = yield load('eslint-plugin-regexp');
83
+ configs.push(...toConfigs(regexp.configs['flat/recommended']).map(withCodeFiles));
84
+ }
85
+ }
86
+ configs.push(...toConfigs(oxlint.configs['flat/all']));
87
+ if (markdown) {
88
+ const mdx = yield load('eslint-plugin-mdx');
89
+ configs.push(Object.assign(Object.assign({}, mdx.flat), { processor: mdx.createRemarkProcessor({ lintCodeBlocks: false }) }));
90
+ }
91
+ if (jsoncEnabled) {
92
+ const jsonc = yield load('eslint-plugin-jsonc');
93
+ configs.push(...toConfigs(jsonc.configs['flat/recommended-with-jsonc']), ...toConfigs(jsonc.configs['flat/prettier']));
94
+ }
95
+ if (yaml) {
96
+ const yml = yield load('eslint-plugin-yml');
97
+ configs.push(...toConfigs(yml.configs['flat/recommended']), ...toConfigs(yml.configs['flat/prettier']));
98
+ }
99
+ if (tomlEnabled) {
100
+ const toml = yield load('eslint-plugin-toml');
101
+ configs.push(...toConfigs(toml.configs['flat/recommended']));
102
+ }
103
+ return configs;
104
+ });
105
+ export default defineConfig();
106
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AA4BzC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9D,MAAM,cAAc,GAAG,UAAU,IAAI,EAAE,CAAA;AAEvC,MAAM,YAAY,GAAG,sCAAsC,CAAA;AAE3D,MAAM,eAAe,GAAG;IACtB,YAAY;IACZ,gBAAgB;IAChB,sBAAsB;IACtB,eAAe;IACf,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,YAAY;IACZ,WAAW;IACX,oBAAoB;IACpB,iBAAiB;IACjB,cAAc;IACd,sBAAsB;IACtB,mBAAmB;IACnB,sBAAsB;IACtB,UAAU;IACV,YAAY;IACZ,YAAY;IAEZ,YAAY;IACZ,UAAU;IACV,uCAAuC;IACvC,WAAW;CACZ,CAAA;AAKD,MAAM,SAAS,GAAG,CAAC,MAAuC,EAAmB,EAAE,CAC7E,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3C,MAAM,aAAa,GAAG,CAAC,MAAqB,EAAiB,EAAE,kBAAC,iCAC3D,MAAM,KACT,KAAK,QAAE,MAAM,CAAC,KAAK,mCAAI,CAAC,YAAY,CAAC,IACrC,GAAA,CAAA;AAEF,MAAM,WAAW,GAAG,CAAC,IAAY,EAAW,EAAE;IAC5C,IAAI,CAAC;QACH,OAAO,OAAO,C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ACJ,CAAC;IAED,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAgB,qBAAqB,CAAC,CAAA;QAC9D,OAAO,CAAC,IAAI,CACV,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,EAC1D,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAC7C,CAAA;IACH,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,GAAG,GAAG,MAAM,IAAI,CAAgB,mBAAmB,CAAC,CAAA;QAC1D,OAAO,CAAC,IAAI,CACV,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,EAC7C,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAC3C,CAAA;IACH,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAgB,oBAAoB,CAAC,CAAA;QAC5D,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA,CAAA;AAED,eAAe,YAAY,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,100 +1,61 @@
1
1
  {
2
2
  "name": "@1stg/eslint-config",
3
- "version": "11.1.0",
3
+ "version": "12.0.1",
4
4
  "type": "module",
5
- "description": "Personal but Shareable ESLint Configuration for all 1stG.me projects",
5
+ "description": "Personal but Shareable ESLint Configuration for the files Oxlint cannot lint",
6
6
  "repository": "git+https://github.com/1stG/configs.git",
7
7
  "homepage": "https://github.com/1stG/configs/tree/master/packages/eslint-config",
8
8
  "author": "JounQin <admin@1stg.me> (https://www.1stG.me)",
9
9
  "funding": "https://opencollective.com/configs",
10
10
  "license": "MIT",
11
11
  "engines": {
12
- "node": ">=24.11.0"
12
+ "node": "^22.18.0 || >=24.11.0"
13
13
  },
14
- "main": "index.js",
14
+ "main": "./lib/index.js",
15
+ "types": "./lib/index.d.ts",
15
16
  "exports": {
16
- ".": "./index.js",
17
- "./package.json": "./package.json",
18
- "./base": "./base.js",
19
- "./loose": "./loose.js",
20
- "./overrides": "./overrides.js",
21
- "./recommended": "./recommended.js"
17
+ ".": {
18
+ "types": "./lib/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./package.json": "./package.json"
22
22
  },
23
+ "files": [
24
+ "lib"
25
+ ],
23
26
  "peerDependencies": {
24
- "@babel/eslint-parser": "^8.0.0",
25
- "@babel/eslint-plugin": "^8.0.0",
26
- "@eslint-react/eslint-plugin": ">=1.0.0",
27
- "@vitest/eslint-plugin": "^1.0.0",
28
- "angular-eslint": ">=18.0.0",
29
- "angular-eslint-template-parser": "^0.1.0",
30
- "eslint": ">=8.0.0",
31
- "eslint-plugin-jest": ">=28.0.0",
32
- "eslint-plugin-node-dependencies": "^1.3.0 || ^2.0.0",
33
- "eslint-plugin-react-hooks": ">=5.0.0",
34
- "eslint-plugin-react-refresh": "^0.4.26 || ^0.5.0",
35
- "eslint-plugin-vue": "^10.0.0"
27
+ "eslint": "^9.39.4 || ^10.0.1",
28
+ "eslint-plugin-markup": "^2.1.0",
29
+ "eslint-plugin-regexp": "^3.3.1",
30
+ "eslint-plugin-sonarjs": "^4.2.2",
31
+ "eslint-plugin-toml": "^1.5.0",
32
+ "eslint-plugin-yml": "^3.9.0",
33
+ "typescript-eslint": "^8.72.0"
36
34
  },
37
35
  "peerDependenciesMeta": {
38
- "@babel/eslint-parser": {
39
- "optional": true
40
- },
41
- "@babel/eslint-plugin": {
42
- "optional": true
43
- },
44
- "@eslint-react/eslint-plugin": {
45
- "optional": true
46
- },
47
- "@vitest/eslint-plugin": {
48
- "optional": true
49
- },
50
- "angular-eslint": {
51
- "optional": true
52
- },
53
- "angular-eslint-template-parser": {
36
+ "eslint-plugin-markup": {
54
37
  "optional": true
55
38
  },
56
- "eslint-plugin-jest": {
39
+ "eslint-plugin-regexp": {
57
40
  "optional": true
58
41
  },
59
- "eslint-plugin-node-dependencies": {
42
+ "eslint-plugin-sonarjs": {
60
43
  "optional": true
61
44
  },
62
- "eslint-plugin-react-hooks": {
45
+ "eslint-plugin-toml": {
63
46
  "optional": true
64
47
  },
65
- "eslint-plugin-react-refresh": {
48
+ "eslint-plugin-yml": {
66
49
  "optional": true
67
50
  },
68
- "eslint-plugin-vue": {
51
+ "typescript-eslint": {
69
52
  "optional": true
70
53
  }
71
54
  },
72
55
  "dependencies": {
73
- "@1stg/config": "^1.2.0",
74
- "@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
75
- "@eslint/js": "^9.39.4 || ^10.0.1",
76
- "@pkgr/utils": "^4.1.0",
77
- "@typescript-eslint/eslint-plugin": "^8.60.0",
78
- "@typescript-eslint/parser": "^8.60.0",
79
- "eslint-config-prettier": "^10.1.8",
80
- "eslint-import-resolver-typescript": "^4.4.4",
81
- "eslint-plugin-css": "^0.12.0",
82
- "eslint-plugin-import-x": "^4.16.2",
83
- "eslint-plugin-jsdoc": ">=50.8.0",
84
- "eslint-plugin-jsonc": "^2.21.1 || ^3.2.0",
85
- "eslint-plugin-markup": "^2.0.0",
86
- "eslint-plugin-mdx": "^3.7.1",
87
- "eslint-plugin-n": "^17.24.0 || ^18.0.1",
88
- "eslint-plugin-prettier": "^5.5.6",
89
- "eslint-plugin-promise": "^7.3.0",
90
- "eslint-plugin-regexp": "^2.10.0 || ^3.1.0",
91
- "eslint-plugin-simple-import-sort": "^14.0.0",
92
- "eslint-plugin-sonarjs": "^4.0.3",
93
- "eslint-plugin-toml": "^0.13.1 || ^1.4.0",
94
- "eslint-plugin-unicorn-x": "^2.0.0 || ^3.2.1",
95
- "eslint-plugin-yml": "^1.19.1 || ^2.0.2 || ^3.4.0",
96
- "globals": "^17.6.0",
97
- "typescript-eslint": "^8.60.0"
56
+ "eslint-plugin-jsonc": "^3.4.2",
57
+ "eslint-plugin-mdx": "^3.8.2",
58
+ "eslint-plugin-oxlint": "^1.89.0"
98
59
  },
99
60
  "publishConfig": {
100
61
  "access": "public"
package/_util.js DELETED
@@ -1,86 +0,0 @@
1
- // @ts-check
2
-
3
- import path from 'node:path'
4
-
5
- import { isCI, isEnvDisabled, isEnvEnabled, preferPrettier } from '@1stg/config'
6
- import {
7
- isMonorepo,
8
- isPkgAvailable,
9
- getMonorepoPkgs,
10
- tryRequirePkg,
11
- tryFile,
12
- tryPkg,
13
- } from '@pkgr/utils'
14
- import configPrettier from 'eslint-config-prettier'
15
- import prettierRecommended from 'eslint-plugin-prettier/recommended'
16
- import tseslint from 'typescript-eslint'
17
-
18
- /** @type {string[]} */
19
- let allowModules = []
20
-
21
- if (isMonorepo()) {
22
- allowModules = getMonorepoPkgs().reduce((acc, pkg) => {
23
- const pkgJson = tryRequirePkg(path.resolve(pkg, 'package.json'))
24
- if (!pkgJson) {
25
- return acc
26
- }
27
- const { name, peerDependencies = {}, dependencies = {} } = pkgJson
28
- // eslint-disable-next-line unicorn-x/prefer-spread
29
- return acc.concat(
30
- name,
31
- Object.keys(peerDependencies),
32
- Object.keys(dependencies),
33
- )
34
- }, /** @type {string[]} */ ([]))
35
- }
36
-
37
- export { allowModules }
38
-
39
- export const isTsAvailable = isPkgAvailable('typescript')
40
-
41
- export const isWebpackAvailable =
42
- isPkgAvailable('webpack') || isPkgAvailable('@rspack/core')
43
-
44
- export const isReactPluginAvailable = isPkgAvailable(
45
- '@eslint-react/eslint-plugin',
46
- )
47
-
48
- export const webpackSpecVars = [
49
- '__non_webpack_require__',
50
- '__resourceQuery',
51
- '__webpack_chunk_load__',
52
- '__webpack_exports_info__',
53
- '__webpack_hash__',
54
- '__webpack_modules__',
55
- '__webpack_public_path__',
56
- '__webpack_require__',
57
- '__webpack_runtime_id__',
58
- 'DEBUG',
59
- ]
60
-
61
- export const magicNumbers = [
62
- -1, 0, 1, 2, 3, 5, 7, 10, 12, 15, 20, 24, 30, 31, 50, 60, 100, 365, 366, 500,
63
- 768, 1000, 1024, 3600, 4200, 8080,
64
- ]
65
-
66
- export const prettierExtends = tseslint.config(
67
- preferPrettier ? configPrettier : prettierRecommended,
68
- )
69
-
70
- export const project =
71
- tryFile('tsconfig.eslint.json') ||
72
- tryFile('tsconfig.base.json') ||
73
- tryFile('tsconfig.json') ||
74
- tryPkg('@1stg/tsconfig')
75
-
76
- export const nonSourceRules = /** @type {const} */ ({
77
- 'n/no-extraneous-import': 0,
78
- 'n/no-extraneous-require': 0,
79
- 'n/no-unsupported-features/es-builtins': 0,
80
- })
81
-
82
- const ESLINT_NODE_DEPS_ENV = 'ESLINT_NODE_DEPS'
83
-
84
- export const isEslintNodeDepsEnabled = isCI
85
- ? !isEnvDisabled(ESLINT_NODE_DEPS_ENV)
86
- : isEnvEnabled(ESLINT_NODE_DEPS_ENV)
package/angular.js DELETED
@@ -1,43 +0,0 @@
1
- // @ts-check
2
-
3
- import { preferPrettier } from '@1stg/config'
4
- import angular_ from 'angular-eslint'
5
- import angularTemplateParser from 'angular-eslint-template-parser'
6
- import * as markup_ from 'eslint-plugin-markup'
7
- import tseslint from 'typescript-eslint'
8
-
9
- import { prettierExtends } from './_util.js'
10
-
11
- export const angular = tseslint.config(
12
- {
13
- name: '@1stg/angular-ts',
14
- files: ['**/*.ts'],
15
- ignores: ['**/*.d.ts'],
16
- extends: [angular_.configs.tsRecommended, prettierExtends],
17
- processor: angular_.processInlineTemplates,
18
- rules: {
19
- '@angular-eslint/prefer-on-push-component-change-detection': 1,
20
- },
21
- },
22
- {
23
- name: '@1stg/angular-template',
24
- files: ['**/*.html'],
25
- extends: [
26
- angular_.configs.templateRecommended,
27
- markup_.configs.flatRecommended,
28
- prettierExtends,
29
- ],
30
- languageOptions: {
31
- parser: angularTemplateParser,
32
- },
33
- rules: {
34
- '@angular-eslint/template/eqeqeq': [2, { allowNullOrUndefined: true }],
35
- 'prettier/prettier': preferPrettier ? 0 : [2, { parser: 'angular' }],
36
- 'spaced-comment': 0,
37
- },
38
- },
39
- {
40
- files: ['**/*inline-template-*.component.html'],
41
- rules: { 'unicorn-x/no-empty-file': 0 },
42
- },
43
- )
package/base.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { TSESLint } from '@typescript-eslint/utils'
2
-
3
- export const base: TSESLint.FlatConfig.ConfigArray