@0xposed/eslint-config 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,52 @@
1
- # Temporary Holding Version
1
+ # @0xposed/eslint-config
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ESLint 9 flat configurations for JavaScript, TypeScript 5, and Svelte 5.
4
+ Requires Node 20.19+.
5
+
6
+ ```sh
7
+ pnpm add -D @0xposed/eslint-config eslint@^9 typescript@^5
8
+ ```
9
+
10
+ Create `eslint.config.mjs`:
11
+
12
+ ```js
13
+ export { default } from '@0xposed/eslint-config';
14
+ ```
15
+
16
+ ## Presets
17
+
18
+ | Import | Environment |
19
+ | ----------------------------------- | ---------------------------------------------- |
20
+ | `@0xposed/eslint-config` or `/node` | Node.js globals |
21
+ | `@0xposed/eslint-config/base` | No environment globals |
22
+ | `@0xposed/eslint-config/svelte` | Svelte/SvelteKit with browser and Node globals |
23
+
24
+ All presets include recommended JavaScript and TypeScript rules, Perfectionist's
25
+ natural import sorting, unused-import checks, and Prettier compatibility. Variables
26
+ and arguments starting with `_` are allowed to be unused. `no-undef` remains
27
+ enabled for JavaScript and is disabled for TypeScript; run your TypeScript or
28
+ Svelte checker for unresolved names in typed code.
29
+ No type-aware linting or `tsconfig.json` is required.
30
+
31
+ For Svelte, install `svelte@^5` in the consuming project and use:
32
+
33
+ ```js
34
+ export { default } from '@0xposed/eslint-config/svelte';
35
+ ```
36
+
37
+ ## Customize
38
+
39
+ ```js
40
+ import config from '@0xposed/eslint-config';
41
+ import sorting from '@0xposed/eslint-config/sorting';
42
+
43
+ export default [...config, sorting];
44
+ ```
45
+
46
+ The optional sorting preset enables all of Perfectionist's recommended natural
47
+ sorting rules, including objects and declarations. The default only sorts imports.
48
+
49
+ In a monorepo, put the appropriate config in each package and run ESLint from
50
+ each package directory (for example, `turbo lint` or `pnpm -r lint`). ESLint 9
51
+ does not select nested package configs when you run `eslint .` at the root.
52
+ Pre-commit commands must also run ESLint from the relevant package directory.
package/base.js ADDED
@@ -0,0 +1,39 @@
1
+ import js from '@eslint/js';
2
+ import prettier from 'eslint-config-prettier';
3
+ import perfectionist from 'eslint-plugin-perfectionist';
4
+ import unusedImports from 'eslint-plugin-unused-imports';
5
+ import tseslint from 'typescript-eslint';
6
+
7
+ export default tseslint.config(
8
+ {
9
+ ignores: [
10
+ '**/node_modules/**',
11
+ '**/dist/**',
12
+ '**/build/**',
13
+ '**/.svelte-kit/**',
14
+ '**/.turbo/**',
15
+ '**/.pnpm-store/**',
16
+ '**/coverage/**',
17
+ '**/logs/**',
18
+ ],
19
+ },
20
+ js.configs.recommended,
21
+ ...tseslint.configs.recommended,
22
+ {
23
+ plugins: { perfectionist, 'unused-imports': unusedImports },
24
+ rules: {
25
+ '@typescript-eslint/no-unused-vars': 'off',
26
+ 'perfectionist/sort-imports': ['error', { type: 'natural' }],
27
+ 'unused-imports/no-unused-imports': 'error',
28
+ 'unused-imports/no-unused-vars': [
29
+ 'error',
30
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
31
+ ],
32
+ },
33
+ },
34
+ {
35
+ files: ['**/*.{ts,tsx,mts,cts}'],
36
+ rules: { 'no-undef': 'off' },
37
+ },
38
+ prettier,
39
+ );
package/node.js ADDED
@@ -0,0 +1,5 @@
1
+ import globals from 'globals';
2
+
3
+ import base from './base.js';
4
+
5
+ export default [...base, { languageOptions: { globals: globals.node } }];
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@0xposed/eslint-config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Shared ESLint flat configs for Node, TypeScript and Svelte projects.",
5
+ "type": "module",
6
+ "main": "./node.js",
7
+ "exports": {
8
+ ".": "./node.js",
9
+ "./base": "./base.js",
10
+ "./node": "./node.js",
11
+ "./svelte": "./svelte.js",
12
+ "./sorting": "./sorting.js"
13
+ },
14
+ "files": [
15
+ "*.js"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "engines": {
21
+ "node": ">=20.19.0"
22
+ },
23
+ "peerDependencies": {
24
+ "eslint": "^9.39.2",
25
+ "svelte": "^5.0.0",
26
+ "typescript": "^5.0.0"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "svelte": {
30
+ "optional": true
31
+ }
32
+ },
33
+ "dependencies": {
34
+ "@eslint/js": "^9.39.2",
35
+ "eslint-config-prettier": "^10.1.8",
36
+ "eslint-plugin-perfectionist": "^5.7.0",
37
+ "eslint-plugin-svelte": "^3.22.0",
38
+ "eslint-plugin-unused-imports": "^4.4.1",
39
+ "globals": "^17.4.0",
40
+ "typescript-eslint": "^8.65.0"
41
+ }
42
+ }
package/sorting.js ADDED
@@ -0,0 +1,3 @@
1
+ import perfectionist from 'eslint-plugin-perfectionist';
2
+
3
+ export default perfectionist.configs['recommended-natural'];
package/svelte.js ADDED
@@ -0,0 +1,16 @@
1
+ import svelte from 'eslint-plugin-svelte';
2
+ import globals from 'globals';
3
+ import tseslint from 'typescript-eslint';
4
+
5
+ import base from './base.js';
6
+
7
+ export default [
8
+ ...base,
9
+ ...svelte.configs['flat/recommended'],
10
+ ...svelte.configs['flat/prettier'],
11
+ { languageOptions: { globals: { ...globals.browser, ...globals.node } } },
12
+ {
13
+ files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
14
+ languageOptions: { parserOptions: { parser: tseslint.parser } },
15
+ },
16
+ ];