@swift-rust/eslint-config 0.2.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 ADDED
@@ -0,0 +1,16 @@
1
+ # @swift-rust/eslint-config
2
+
3
+ Shareable ESLint config used by `create-swift-rust` and the framework's own packages.
4
+
5
+ ## Usage
6
+
7
+ ```js
8
+ // eslint.config.js
9
+ import swiftRustConfig from "@swift-rust/eslint-config";
10
+
11
+ export default swiftRustConfig({
12
+ react: "detect",
13
+ typescript: true,
14
+ jsx: true,
15
+ });
16
+ ```
@@ -0,0 +1,37 @@
1
+ export interface EslintConfigOptions {
2
+ root?: boolean;
3
+ react?: "detect" | "off" | "on";
4
+ typescript?: boolean;
5
+ jsx?: boolean;
6
+ prettier?: boolean;
7
+ ignores?: string[];
8
+ }
9
+ export declare function buildConfig(options?: EslintConfigOptions): {
10
+ root: boolean;
11
+ ignores: string[];
12
+ parser: string | undefined;
13
+ parserOptions: {
14
+ ecmaVersion: number;
15
+ sourceType: string;
16
+ ecmaFeatures: {
17
+ jsx: boolean;
18
+ } | undefined;
19
+ } | undefined;
20
+ plugins: string[];
21
+ extends: string[];
22
+ settings: {
23
+ react: {
24
+ version: string;
25
+ };
26
+ };
27
+ rules: {
28
+ "react/react-in-jsx-scope": string;
29
+ "react/prop-types": string;
30
+ "@typescript-eslint/no-unused-vars": (string | {
31
+ argsIgnorePattern: string;
32
+ })[];
33
+ "@typescript-eslint/consistent-type-imports": string;
34
+ };
35
+ };
36
+ export default buildConfig;
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAcD,wBAAgB,WAAW,CAAC,OAAO,GAAE,mBAAwB;;;;;;;;;;;aA2BpC,MAAM,EAAE;aAQR,MAAM,EAAE;;;;;;;;;;;;;;EAWhC;AAED,eAAe,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ const SHARED_IGNORES = [
2
+ ".next/**",
3
+ ".turbo/**",
4
+ ".swift-rust/**",
5
+ "dist/**",
6
+ "node_modules/**",
7
+ "target/**",
8
+ "coverage/**",
9
+ "**/*.min.js",
10
+ "**/*.d.ts",
11
+ ];
12
+ export function buildConfig(options = {}) {
13
+ const { root = true, react = "detect", typescript = true, jsx = true, prettier: usePrettier = true, ignores = [], } = options;
14
+ return {
15
+ root,
16
+ ignores: [...SHARED_IGNORES, ...ignores],
17
+ parser: typescript ? "@typescript-eslint/parser" : undefined,
18
+ parserOptions: typescript
19
+ ? {
20
+ ecmaVersion: 2022,
21
+ sourceType: "module",
22
+ ecmaFeatures: jsx ? { jsx: true } : undefined,
23
+ }
24
+ : undefined,
25
+ plugins: [
26
+ typescript && "@typescript-eslint",
27
+ react !== "off" && "react",
28
+ react !== "off" && "react-hooks",
29
+ "import",
30
+ jsx && "jsx-a11y",
31
+ ].filter(Boolean),
32
+ extends: [
33
+ "eslint:recommended",
34
+ typescript && "plugin:@typescript-eslint/recommended",
35
+ react === "on" && "plugin:react/recommended",
36
+ react === "on" && "plugin:react-hooks/recommended",
37
+ jsx && "plugin:jsx-a11y/recommended",
38
+ usePrettier && "prettier",
39
+ ].filter(Boolean),
40
+ settings: {
41
+ react: { version: "detect" },
42
+ },
43
+ rules: {
44
+ "react/react-in-jsx-scope": "off",
45
+ "react/prop-types": "off",
46
+ "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
47
+ "@typescript-eslint/consistent-type-imports": "warn",
48
+ },
49
+ };
50
+ }
51
+ export default buildConfig;
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,MAAM,cAAc,GAAG;IACrB,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,SAAS;IACT,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,aAAa;IACb,WAAW;CACZ,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,UAA+B,EAAE;IAC3D,MAAM,EACJ,IAAI,GAAG,IAAI,EACX,KAAK,GAAG,QAAQ,EAChB,UAAU,GAAG,IAAI,EACjB,GAAG,GAAG,IAAI,EACV,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,OAAO,GAAG,EAAE,GACb,GAAG,OAAO,CAAC;IAEZ,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,CAAC,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC;QACxC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS;QAC5D,aAAa,EAAE,UAAU;YACvB,CAAC,CAAC;gBACE,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;aAC9C;YACH,CAAC,CAAC,SAAS;QACb,OAAO,EAAE;YACP,UAAU,IAAI,oBAAoB;YAClC,KAAK,KAAK,KAAK,IAAI,OAAO;YAC1B,KAAK,KAAK,KAAK,IAAI,aAAa;YAChC,QAAQ;YACR,GAAG,IAAI,UAAU;SAClB,CAAC,MAAM,CAAC,OAAO,CAAa;QAC7B,OAAO,EAAE;YACP,oBAAoB;YACpB,UAAU,IAAI,uCAAuC;YACrD,KAAK,KAAK,IAAI,IAAI,0BAA0B;YAC5C,KAAK,KAAK,IAAI,IAAI,gCAAgC;YAClD,GAAG,IAAI,6BAA6B;YACpC,WAAW,IAAI,UAAU;SAC1B,CAAC,MAAM,CAAC,OAAO,CAAa;QAC7B,QAAQ,EAAE;YACR,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;SAC7B;QACD,KAAK,EAAE;YACL,0BAA0B,EAAE,KAAK;YACjC,kBAAkB,EAAE,KAAK;YACzB,mCAAmC,EAAE,CAAC,MAAM,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;YAC1E,4CAA4C,EAAE,MAAM;SACrD;KACF,CAAC;AACJ,CAAC;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=smoke.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smoke.test.d.ts","sourceRoot":"","sources":["../src/smoke.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { expect, test } from "bun:test";
2
+ import * as mod from "./index";
3
+ test("package exports a default or named module", () => {
4
+ expect(mod).toBeDefined();
5
+ });
6
+ //# sourceMappingURL=smoke.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smoke.test.js","sourceRoot":"","sources":["../src/smoke.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAE/B,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACrD,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@swift-rust/eslint-config",
3
+ "version": "0.2.0",
4
+ "description": "Shared ESLint configuration for swift-rust projects.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.json",
20
+ "dev": "tsc -p tsconfig.json --watch",
21
+ "lint": "biome check --no-errors-on-unmatched $(pwd)/src",
22
+ "typecheck": "tsc --noEmit",
23
+ "clean": "rm -rf dist .turbo"
24
+ },
25
+ "peerDependencies": {
26
+ "eslint": "^8.57.0 || ^9.0.0"
27
+ },
28
+ "dependencies": {
29
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
30
+ "@typescript-eslint/parser": "^7.0.0",
31
+ "eslint-config-prettier": "^9.1.0",
32
+ "eslint-plugin-import": "^2.31.0",
33
+ "eslint-plugin-jsx-a11y": "^6.10.0",
34
+ "eslint-plugin-react": "^7.35.0",
35
+ "eslint-plugin-react-hooks": "^4.6.0"
36
+ },
37
+ "devDependencies": {
38
+ "eslint": "^8.57.0",
39
+ "typescript": "^6.0.0"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://github.com/swift-rust/swift-rust.git",
47
+ "directory": "packages/eslint-config"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/swift-rust/swift-rust/issues"
51
+ },
52
+ "homepage": "https://swift-rust.dev"
53
+ }