From d5bc9e1aa4c1c4fb6666521e34e24e401d40c162 Mon Sep 17 00:00:00 2001 From: ModyQyW Date: Tue, 30 May 2023 09:18:31 +0800 Subject: [PATCH] feat: support solid --- package.json | 2 ++ pnpm-lock.yaml | 66 +++++++++++++++++++++++++++++++++++++++++++++ src/eslint/index.ts | 6 +++++ src/helpers.ts | 2 ++ 4 files changed, 76 insertions(+) diff --git a/package.json b/package.json index 7dd520ee..c6b6c0b5 100644 --- a/package.json +++ b/package.json @@ -109,6 +109,7 @@ "eslint-config-prettier": "^8.8.0", "eslint-import-resolver-node": "^0.3.7", "eslint-import-resolver-typescript": "^3.5.5", + "eslint-plugin-check-file": "^2.3.0", "eslint-plugin-import": "npm:eslint-plugin-i", "eslint-plugin-jsonc": "^2.8.0", "eslint-plugin-jsx-a11y": "^6.7.1", @@ -121,6 +122,7 @@ "eslint-plugin-react-native": "^4.0.0", "eslint-plugin-react-native-a11y": "^3.3.0", "eslint-plugin-regexp": "^1.15.0", + "eslint-plugin-solid": "^0.12.1", "eslint-plugin-unicorn": "^47.0.0", "eslint-plugin-vue": "^9.13.0", "eslint-plugin-vue-scoped-css": "^2.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index da0a608e..06433d07 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,6 +58,9 @@ dependencies: eslint-import-resolver-typescript: specifier: ^3.5.5 version: 3.5.5(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-node@0.3.7)(eslint-plugin-i@2.27.5-1)(eslint@8.40.0) + eslint-plugin-check-file: + specifier: ^2.3.0 + version: 2.3.0(eslint@8.40.0) eslint-plugin-import: specifier: npm:eslint-plugin-i version: /eslint-plugin-i@2.27.5-1(@typescript-eslint/parser@5.59.6)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) @@ -94,6 +97,9 @@ dependencies: eslint-plugin-regexp: specifier: ^1.15.0 version: 1.15.0(eslint@8.40.0) + eslint-plugin-solid: + specifier: ^0.12.1 + version: 0.12.1(eslint@8.40.0)(typescript@5.0.4) eslint-plugin-unicorn: specifier: ^47.0.0 version: 47.0.0(eslint@8.40.0) @@ -3149,6 +3155,18 @@ packages: - supports-color dev: false + /eslint-plugin-check-file@2.3.0(eslint@8.40.0): + resolution: {integrity: sha512-oTaKN2bdBJO8YpiuixhRgQwIPI3gXKHrgYWhO3POsXuwcXimPXUTqhgbPZpdndpgdD9GJn61y1F2s4S4Z0/xxA==} + engines: {node: 14.x || >= 16} + peerDependencies: + eslint: '>=7.28.0' + dependencies: + eslint: 8.40.0 + is-glob: 4.0.3 + micromatch: 4.0.5 + requireindex: 1.2.0 + dev: false + /eslint-plugin-es-x@6.1.0(eslint@8.40.0): resolution: {integrity: sha512-f6dHOuVDDYHOCu3w+EledZnUkDdCa71GGHxZ0DMNfalM/2Upl0t/ks0+d5W5YDQJEQmvthE3WYv7RI/9Fl+csQ==} engines: {node: ^14.18.0 || >=16.0.0} @@ -3393,6 +3411,24 @@ packages: scslre: 0.2.0 dev: false + /eslint-plugin-solid@0.12.1(eslint@8.40.0)(typescript@5.0.4): + resolution: {integrity: sha512-fM0sEg9PcS1mcNbWklwc+W/lOv1/XyEwXf53HmFFy4GOA8E3u41h8JW+hc+Vv1m3kh01umKoTalOTET08zKdAQ==} + engines: {node: '>=12.0.0'} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + '@typescript-eslint/utils': 5.59.6(eslint@8.40.0)(typescript@5.0.4) + eslint: 8.40.0 + is-html: 2.0.0 + jsx-ast-utils: 3.3.3 + kebab-case: 1.0.2 + known-css-properties: 0.24.0 + style-to-object: 0.3.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: false + /eslint-plugin-unicorn@47.0.0(eslint@8.40.0): resolution: {integrity: sha512-ivB3bKk7fDIeWOUmmMm9o3Ax9zbMz1Bsza/R2qm46ufw4T6VBFBaJIR1uN3pCKSmSXm8/9Nri8V+iUut1NhQGA==} engines: {node: '>=16'} @@ -4328,6 +4364,10 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dev: true + /inline-style-parser@0.1.1: + resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==} + dev: false + /inquirer@6.5.2: resolution: {integrity: sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==} engines: {node: '>=6.0.0'} @@ -4498,6 +4538,13 @@ packages: resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==} dev: false + /is-html@2.0.0: + resolution: {integrity: sha512-S+OpgB5i7wzIue/YSE5hg0e5ZYfG3hhpNh9KGl6ayJ38p7ED6wxQLd1TV91xHpcTvw90KMJ9EwN3F/iNflHBVg==} + engines: {node: '>=8'} + dependencies: + html-tags: 3.3.1 + dev: false + /is-interactive@1.0.0: resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} engines: {node: '>=8'} @@ -4792,6 +4839,10 @@ packages: object.assign: 4.1.4 dev: false + /kebab-case@1.0.2: + resolution: {integrity: sha512-7n6wXq4gNgBELfDCpzKc+mRrZFs7D+wgfF5WRFLNAr4DA/qtr9Js8uOAVAfHhuLMfAcQ0pRKqbpjx+TcJVdE1Q==} + dev: false + /kind-of@6.0.3: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} @@ -4806,6 +4857,10 @@ packages: engines: {node: '>=6'} dev: false + /known-css-properties@0.24.0: + resolution: {integrity: sha512-RTSoaUAfLvpR357vWzAz/50Q/BmHfmE6ETSWfutT0AJiw10e6CmcdYRQJlLRd95B53D0Y2aD1jSxD3V3ySF+PA==} + dev: false + /known-css-properties@0.27.0: resolution: {integrity: sha512-uMCj6+hZYDoffuvAJjFAPz56E9uoowFHmTkqRtRq5WyC5Q6Cu/fTZKNQpX/RbzChBYLLl3lo8CjFZBAZXq9qFg==} @@ -6528,6 +6583,11 @@ packages: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} + /requireindex@1.2.0: + resolution: {integrity: sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==} + engines: {node: '>=0.10.5'} + dev: false + /resolve-dir@1.0.1: resolution: {integrity: sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==} engines: {node: '>=0.10.0'} @@ -7066,6 +7126,12 @@ packages: /style-search@0.1.0: resolution: {integrity: sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==} + /style-to-object@0.3.0: + resolution: {integrity: sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==} + dependencies: + inline-style-parser: 0.1.1 + dev: false + /stylelint-config-recess-order@4.0.0(stylelint@15.6.2): resolution: {integrity: sha512-sOb+OofMryBR91CbzgV2FavpONqiIeAE7cfrgyUHqePblWBKsYzoUuWThI5EjPRA7KKeovm6ykr7twWYLeafPQ==} peerDependencies: diff --git a/src/eslint/index.ts b/src/eslint/index.ts index f7657289..8ca6c7ae 100644 --- a/src/eslint/index.ts +++ b/src/eslint/index.ts @@ -10,6 +10,7 @@ import { enableNext, enableReactNative, enableReact, + enableSolid, enableMiniprogram, enablePrettier, } from '../helpers'; @@ -97,6 +98,11 @@ const config: Linter.Config = { enableReactNative ? 'plugin:react-native/all' : '', enableReactNative ? 'plugin:react-native-a11y/all' : '', enableNext ? 'next/core-web-vitals' : '', + enableSolid + ? enableTypeScript + ? 'plugin:solid/typescript' + : 'plugin:solid/recommended' + : '', enablePrettier ? 'plugin:prettier/recommended' : '', ].filter((item) => !!item), rules: reactRules, diff --git a/src/helpers.ts b/src/helpers.ts index 7e996d6d..ad4ca4fc 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -24,6 +24,8 @@ export const enableReactNative = export const enableReact = isPackageExists('react') || Boolean(process.env.ENABLE_REACT) || enableNext || enableReactNative; +export const enableSolid = isPackageExists('solid-js') || Boolean(process.env.ENABLE_SOLID); + export const enableMiniprogram = isPackageExists('@dcloudio/vite-plugin-uni') || isPackageExists('@dcloudio/vue-cli-plugin-uni') ||