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

feat: add biome #1281

Merged
merged 28 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fd7a65a
feat: biome
ErKeLost May 3, 2024
712e975
chore: test biome
ErKeLost May 3, 2024
61bb755
chore: update code
ErKeLost May 3, 2024
f8d2dcb
chore: update code
ErKeLost May 3, 2024
7ea1b8b
chore: update changeset
ErKeLost May 3, 2024
01240e1
chore: update biome rules
ErKeLost May 4, 2024
7677feb
chore: enable biome lint
ErKeLost May 4, 2024
0d87df6
chore: remove eslint and prettier
ErKeLost May 4, 2024
df4a308
chore: remove eslint and prettier
ErKeLost May 4, 2024
36252ae
Merge branch 'main' into feat/biome_2
ErKeLost May 4, 2024
eec7d09
chore: test lint-staged
ErKeLost May 4, 2024
11d28dd
chore: test lint-staged
ErKeLost May 4, 2024
05daacb
Merge branch 'feat/biome_2' of github.com:ErKeLost/farm into feat/bio…
ErKeLost May 4, 2024
5bc4606
chore: test lint-staged
ErKeLost May 4, 2024
1e6c7b4
chore: test lint-staged
ErKeLost May 4, 2024
f079d5c
chore: test lint-staged
ErKeLost May 4, 2024
50968e0
chore: test lint-staged
ErKeLost May 4, 2024
9127dfd
chore: test lint-staged
ErKeLost May 4, 2024
8fcbb28
chore: update test lint-staged
ErKeLost May 4, 2024
08d566d
chore: update test lint-staged
ErKeLost May 4, 2024
633e54c
chore: update test lint-staged
ErKeLost May 4, 2024
144960c
chore: update test lint-staged
ErKeLost May 4, 2024
d7ee852
chore: update husky
ErKeLost May 4, 2024
50eadbd
chore: update husky
ErKeLost May 4, 2024
2ea1fd3
chore: update husky
ErKeLost May 4, 2024
31ab041
chore: update husky
ErKeLost May 4, 2024
2ffe5e9
chore: update husky
ErKeLost May 4, 2024
df62f7a
chore: update husky
ErKeLost May 4, 2024
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
2 changes: 2 additions & 0 deletions .changeset/sweet-stingrays-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
3 changes: 1 addition & 2 deletions .eslintrc.base.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down
12 changes: 7 additions & 5 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ function readPackage(pkg, context) {
// Replace [email protected] with [email protected]
pkg.peerDependencies = {
vue: pkg.version
}
context.log(`${pkg.name}@${pkg.version} => vue@${pkg.version} in peerDependencies`)
};
context.log(
`${pkg.name}@${pkg.version} => vue@${pkg.version} in peerDependencies`
);
}
return pkg

return pkg;
}

module.exports = {
hooks: {
readPackage
}
}
};
66 changes: 66 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.2/schema.json",
"vcs": {
"clientKind": "git",
"enabled": true,
"useIgnoreFile": true,
"defaultBranch": "main"
},
"files": {
"ignore": [
"crates/**",
"examples/**",
"tsconfig.base.json",
"tsconfig.json",
"cspell.json",
"e2e/**",
"*.e2e.ts",
"*.d.ts",
"packages/runtime/**",
"packages/create-farm/templates/**",
"packages/create-farm-plugin/templates/**",
"rust-plugins/**"
],
"ignoreUnknown": true
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto"
},
"organizeImports": {
"enabled": true,
"include": ["./**/*.js", "./**/*.ts", "./**/*.mjs"]
},
"linter": {
"enabled": false,
"rules": {
"recommended": true
},
"ignore": [
"**/binding/**",
"**/templates/**",
"**/dist/**",
"**/node_modules/**",
"**/*.config.js",
"**/*.config.ts"
]
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "single",
"quoteProperties": "asNeeded",
"trailingComma": "none",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSpacing": true,
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "auto"
}
}
}
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
}
};
22 changes: 11 additions & 11 deletions js-plugins/dts/farm.config.mjs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { builtinModules } from "module";
import { builtinModules } from 'module';

/**
* @type {import('@farmfe/core').UserConfig}
*/
export default {
compilation: {
input: {
index: "./src/index.ts",
index: './src/index.ts'
},
output: {
path: "build",
entryFilename: "[entryName].cjs",
targetEnv: "node",
format: "cjs",
path: 'build',
entryFilename: '[entryName].cjs',
targetEnv: 'node',
format: 'cjs'
},
partialBundling: {
enforceResources: [
{
name: "index.js",
test: [".+"],
},
],
name: 'index.js',
test: ['.+']
}
]
},
minify: false,
sourcemap: false,
persistentCache: false,
presetEnv: false,
presetEnv: false
}
};
7 changes: 2 additions & 5 deletions js-plugins/dts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,5 @@
"@farmfe/core": "workspace:*",
"@types/fs-extra": "^11.0.1"
},
"files": [
"dist",
"build"
]
}
"files": ["dist", "build"]
}
10 changes: 5 additions & 5 deletions js-plugins/dts/src/context.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os from 'node:os';
import { relative, resolve } from 'node:path';
import type { UserConfig } from '@farmfe/core';
import { DefaultLogger } from './logger.js';
import chalk from 'chalk';
import glob from 'fast-glob';
import os from 'node:os';
import { relative, resolve } from 'node:path';
import { CompilerOptions, Project, SourceFile } from 'ts-morph';
import { DefaultLogger } from './logger.js';
import {
ensureAbsolute,
ensureArray,
Expand Down Expand Up @@ -108,8 +108,8 @@ export default class Context {
(isRegExp(find)
? find.toString() === alias.toString()
: isRegExp(alias)
? find.match(alias)?.[0]
: find === alias)
? find.match(alias)?.[0]
: find === alias)
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion js-plugins/dts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { JsPlugin } from '@farmfe/core';

import Context from './context.js';
import { tryToReadFileSync } from './utils.js';
import { pluginName } from './options.js';
import { tryToReadFileSync } from './utils.js';

import type { DtsPluginOptions } from './types.js';

Expand Down
2 changes: 1 addition & 1 deletion js-plugins/dts/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ts, Diagnostic } from 'ts-morph';
import type { Diagnostic, ts } from 'ts-morph';

export interface DtsPluginOptions {
/**
Expand Down
2 changes: 1 addition & 1 deletion js-plugins/dts/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import path, {
resolve
} from 'node:path';

import typescript from 'typescript';
import extra from 'fs-extra';
import typescript from 'typescript';

import crypto from 'crypto';
import fs from 'node:fs';
Expand Down
1 change: 0 additions & 1 deletion js-plugins/less/farm.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import farmDtsPlugin from '@farmfe/js-plugin-dts';
import { createFarmJsPluginBuildConfig } from '../../configs/farm-js-plugin.base.config.mjs';

Expand Down
6 changes: 2 additions & 4 deletions js-plugins/less/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
"clean": "rimraf dist build tsconfig.build.tsbuildinfo",
"type-check": "tsc -p ./tsconfig.build.json --noEmit"
},
"files": [
"build"
],
"files": ["build"],
"keywords": [],
"license": "MIT",
"devDependencies": {
Expand All @@ -49,4 +47,4 @@
"@farmfe/core": "workspace:^1.1.0",
"less": "^3.5.0 || ^4.0.0"
}
}
}
6 changes: 3 additions & 3 deletions js-plugins/less/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { existsSync } from 'fs';
import path from 'path';
import {
Compiler,
JsPlugin,
UserConfig,
getAdditionContext
} from '@farmfe/core';
import { createLessResolvePlugin } from './plugin-resolve.js';
import {
getLessImplementation,
pluginName,
throwError,
tryRead
} from './utils.js';
import path from 'path';
import { existsSync } from 'fs';
import { createLessResolvePlugin } from './plugin-resolve.js';

export type LessPluginOptions = {
lessOptions?: Less.Options;
Expand Down
2 changes: 1 addition & 1 deletion js-plugins/less/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { throwError as t } from '@farmfe/core';
import fs from 'fs';
import { createRequire } from 'module';
import { throwError as t } from '@farmfe/core';

const __require = createRequire(import.meta.url);

Expand Down
6 changes: 2 additions & 4 deletions js-plugins/postcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
"prepublishOnly": "npm run build",
"type-check": "tsc -p ./tsconfig.build.json --noEmit"
},
"files": [
"build"
],
"files": ["build"],
"keywords": [],
"license": "MIT",
"devDependencies": {
Expand All @@ -54,4 +52,4 @@
"@farmfe/core": "workspace:^1.1.0",
"postcss": ">=8.0.0"
}
}
}
11 changes: 7 additions & 4 deletions js-plugins/postcss/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { JsPlugin, ResolvedUserConfig, checkPublicFile } from '@farmfe/core';
import postcssLoadConfig from 'postcss-load-config';
import { ProcessOptions, Processor } from 'postcss';
import path from 'path';
import { JsPlugin, ResolvedUserConfig, checkPublicFile } from '@farmfe/core';
import glob from 'fast-glob';
import { ProcessOptions, Processor } from 'postcss';
import postcssLoadConfig from 'postcss-load-config';
import { getPostcssImplementation, pluginName, tryRead } from './utils.js';

export type PostcssPluginOptions = {
Expand Down Expand Up @@ -115,7 +115,10 @@ export default function farmPostcssPlugin(
]);
const { css } = await urlRebasePostcssProcessor.process(
content,
{ from: id, to: param.resolvedPath }
{
from: id,
to: param.resolvedPath
}
);
return css;
}
Expand Down
1 change: 0 additions & 1 deletion js-plugins/sass/farm.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import farmDtsPlugin from '@farmfe/js-plugin-dts';
import { createFarmJsPluginBuildConfig } from '../../configs/farm-js-plugin.base.config.mjs';

Expand Down
6 changes: 2 additions & 4 deletions js-plugins/sass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
"prepublishOnly": "npm run build",
"type-check": "tsc -p ./tsconfig.build.json --noEmit"
},
"files": [
"build"
],
"files": ["build"],
"keywords": [],
"license": "MIT",
"devDependencies": {
Expand All @@ -56,4 +54,4 @@
"sass": "^1.3.0",
"sass-embedded": "*"
}
}
}
14 changes: 7 additions & 7 deletions js-plugins/sass/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { existsSync } from 'fs';
import path, { isAbsolute } from 'path';
import { fileURLToPath, pathToFileURL } from 'url';
import type {
CompilationContext,
JsPlugin,
UserConfig,
PluginTransformHookParam,
CompilationContext
UserConfig
} from '@farmfe/core';
import { getAdditionContext, rebaseUrls } from '@farmfe/core';
import type { StringOptions, CompileResult, LegacyOptions } from 'sass';
import { readFile } from 'fs/promises';
import type { CompileResult, LegacyOptions, StringOptions } from 'sass';
import * as Sass from 'sass';
import { pluginName, throwError, tryRead } from './options.js';
import { fileURLToPath, pathToFileURL } from 'url';
import { getSassImplementation } from './utils.js';
import path, { isAbsolute } from 'path';
import { existsSync } from 'fs';
import { readFile } from 'fs/promises';

export type SassPluginOptions<Legacy = boolean> = {
sassOptions?: Partial<
Expand Down
2 changes: 1 addition & 1 deletion js-plugins/sass/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { throwError } from './options.js';
import { createRequire } from 'module';
import { throwError } from './options.js';

const __require = createRequire(import.meta.url);
/**
Expand Down
13 changes: 6 additions & 7 deletions js-plugins/solid/farm.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

import farmDtsPlugin from '@farmfe/js-plugin-dts';
import { createFarmJsPluginBuildConfig } from '../../configs/farm-js-plugin.base.config.mjs';

export default createFarmJsPluginBuildConfig([farmDtsPlugin()], {
external: [
"@babel/core",
"@babel/preset-typescript",
"@rollup/pluginutils",
"babel-preset-solid",
"merge-anything",
"solid-refresh"
'@babel/core',
'@babel/preset-typescript',
'@rollup/pluginutils',
'babel-preset-solid',
'merge-anything',
'solid-refresh'
]
});
6 changes: 2 additions & 4 deletions js-plugins/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,5 @@
"peerDependencies": {
"@farmfe/core": "workspace:^1.1.2"
},
"files": [
"build"
]
}
"files": ["build"]
}
Loading
Loading