Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): change helper folder structure #240

Merged
merged 7 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ jobs:
- name: Check Types
run: yarn workspace @storyblok/field-plugin check:types
- name: Lint
run: yarn eslint packages/field-plugin
run: |
yarn eslint packages/field-plugin --ignore-pattern "packages/field-plugin/helpers/"
yarn workspaces foreach --include "helper-*" run lint
Comment on lines +27 to +28
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • line 27: ignore helpers from eslint
  • line 28: run eslint for helpers with their own configs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should they run separately?

Does this not solve the problem:

helper-vue3/.eslintrc.json

{
  "root": true,
  ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't work. As far as I understand, the moment you run yarn eslint packages/field-plugin, it loads the root eslint config and apply it to all the files below. That root: true prevents your eslint process from "going up". So I had to separate them to make them work. Maybe I should just ignore the helpers in the root eslint config, so that I don't have to explicitly exclude them in the command line?

- name: Test
run: yarn workspace @storyblok/field-plugin test
- name: Build
run: yarn workspace @storyblok/field-plugin build

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
packages/*/dist/
packages/**/dist/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
],
"workspaces": [
"packages/*",
"packages/cli/templates/*"
"packages/cli/templates/*",
"packages/field-plugin/helpers/*"
],
"engines": {
"yarn": "^3.2.4"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --resolve-plugins-relative-to ."
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
},
"dependencies": {
"@storyblok/field-plugin": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
"parser": "@typescript-eslint/parser",
"sourceType": "module"
},
"plugins": [
"prettier",
"@typescript-eslint",
"vue"
],
"rules": {
}
"plugins": ["prettier", "@typescript-eslint", "vue"],
"rules": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build && mv dist/src/* dist/",
"lint": "eslint ."
"build": "vue-tsc && vite build",
"lint": "eslint src"
},
"dependencies": {
"@storyblok/field-plugin": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
FieldPluginResponse,
FieldPluginData,
} from '@storyblok/field-plugin'
import { convertToRaw } from '../utils'
import { convertToRaw } from './utils'

const plugin = reactive<FieldPluginResponse>({
type: 'loading',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { toRaw, isProxy, isRef, unref } from 'vue'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function convertToRaw(value: any): any {
let rawValue = value
if (isProxy(rawValue)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
Expand All @@ -22,12 +18,7 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue"
],
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [
{
"path": "./tsconfig.node.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": [
"vite.config.ts"
]
"include": ["vite.config.ts"]
}
6 changes: 3 additions & 3 deletions scripts/copy-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mkdir ./packages/field-plugin/dist/{react,vue2,vue3}

cp -r ./packages/helper-react/dist/* ./packages/field-plugin/dist/react/
cp -r ./packages/helper-vue2/dist/* ./packages/field-plugin/dist/vue2/
cp -r ./packages/helper-vue3/dist/* ./packages/field-plugin/dist/vue3/
cp -r ./packages/field-plugin/helpers/react/dist/* ./packages/field-plugin/dist/react/
cp -r ./packages/field-plugin/helpers/vue2/dist/* ./packages/field-plugin/dist/vue2/
cp -r ./packages/field-plugin/helpers/vue3/dist/* ./packages/field-plugin/dist/vue3/

Loading