Skip to content

Commit

Permalink
style: new code style (#1615)
Browse files Browse the repository at this point in the history
* style: new code style

* style: apply
  • Loading branch information
dangreen committed Feb 7, 2022
1 parent 1a0d845 commit 92f7866
Show file tree
Hide file tree
Showing 114 changed files with 13,852 additions and 14,091 deletions.
18 changes: 9 additions & 9 deletions .babelrc.esmodules.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"exclude": "node_modules/**",
"presets": [
["@trigen/babel-preset", {
"env": "lib",
"targets": {
"esmodules": true
}
}]
]
"exclude": "node_modules/**",
"presets": [
["@trigen/babel-preset", {
"env": "lib",
"targets": {
"esmodules": true
}
}]
]
}
38 changes: 19 additions & 19 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"exclude": "node_modules/**",
"presets": [
["@trigen/babel-preset", {
"env": "lib"
}]
],
"env": {
"test": {
"presets": [
[
"@trigen/babel-preset",
{
"env": "jest",
"typescript": true
}
]
]
}
}
"exclude": "node_modules/**",
"presets": [
["@trigen/babel-preset", {
"env": "lib"
}]
],
"env": {
"test": {
"presets": [
[
"@trigen/babel-preset",
{
"env": "jest",
"typescript": true
}
]
]
}
}
}
2 changes: 1 addition & 1 deletion .clean-publish
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"packageManager": "pnpm"
"packageManager": "pnpm"
}
13 changes: 3 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
root = true

[*]
indent_style = tab
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,manifest.json,*.yml}]
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
end_of_line = lf
62 changes: 21 additions & 41 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,23 @@
{
"extends": [
"@trigen/eslint-config",
"@trigen/eslint-config/typescript",
"@trigen/eslint-config/typescript-requiring-type-checking",
"@trigen/eslint-config/jest"
],
"env": {
"node": true
},
"parserOptions": {
"tsconfigRootDir": "./",
"project": ["./tsconfig.json", "./test/tsconfig.json"]
},
"rules": {
"no-magic-numbers": "off",
"max-params": "off"
},
"overrides": [{
"files": ["*.ts"],
"rules": {
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/naming-convention": ["error", {
"selector": "default",
"format": ["camelCase", "PascalCase", "UPPER_CASE"]
}, {
"selector": "function",
"format": ["camelCase", "PascalCase"]
}, {
"selector": "parameter",
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "allow"
}, {
"selector": "typeLike",
"format": ["PascalCase"]
}, {
"selector": "interface",
"format": ["PascalCase"],
"prefix": ["I"]
}]
}
}]
"extends": [
"@trigen/eslint-config",
"@trigen/eslint-config/typescript",
"@trigen/eslint-config/typescript-requiring-type-checking",
"@trigen/eslint-config/jest"
],
"env": {
"node": true
},
"parserOptions": {
"tsconfigRootDir": "./",
"project": ["./tsconfig.json", "./test/tsconfig.json"]
},
"rules": {
"prefer-destructuring": "off",
"no-magic-numbers": "off",
"max-params": "off",
"@typescript-eslint/no-magic-numbers": "off",
"import/no-default-export": "off",
"@typescript-eslint/no-unnecessary-condition": "off"
}
}
19 changes: 19 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Checks
on:
pull_request:
branches:
- master
jobs:
editorconfig:
runs-on: ubuntu-latest
name: Checking editorconfig
env:
CI_JOB_NUMBER: 1
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Create config
run: |
echo '{"Exclude": ["docs"]}' > .ecrc
- name: Check editorconfig
uses: editorconfig-checker/action-editorconfig-checker@v1
1 change: 1 addition & 0 deletions .nano-staged.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rollup.config.js": "eslint --fix",
"src/**/*.ts": "eslint --fix",
"types/**/*.ts": "eslint --fix",
"test/**/*.{js,ts}": "eslint --fix"
}
40 changes: 20 additions & 20 deletions .size-limit.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[
{
"path": "lib/index.cjs",
"limit": "47 KB",
"webpack": false
},
{
"path": "lib/index.es.js",
"limit": "45 KB",
"webpack": false
},
{
"path": "lib/umd.js",
"limit": "62 KB",
"webpack": false
},
{
"path": "lib/index.babel.js",
"limit": "37 KB",
"webpack": false
}
{
"path": "lib/index.cjs",
"limit": "47 KB",
"webpack": false
},
{
"path": "lib/index.es.js",
"limit": "45 KB",
"webpack": false
},
{
"path": "lib/umd.js",
"limit": "62 KB",
"webpack": false
},
{
"path": "lib/index.babel.js",
"limit": "37 KB",
"webpack": false
}
]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ let v = null;
window.onload = async () => {
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');

v = await Canvg.from(ctx, './svgs/1.svg');

// Start SVG rendering with animations and mouse handling.
Expand Down Expand Up @@ -210,7 +210,7 @@ self.onmessage = async (event) => {
window.onload = () => {
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
v = canvg.Canvg.fromString(ctx, '<svg width="600" height="600"><text x="50" y="50">Hello World!</text></svg>');
// Start SVG rendering with animations and mouse handling.
Expand Down
32 changes: 16 additions & 16 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"testRunner": "jest-circus/runner",
"testEnvironment": "node",
"testRegex": "/test/.*\\.spec\\.(jsx?|tsx?)$",
"transform": {
"^.+\\.(jsx?|tsx?)$": "babel-jest"
},
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!**/*.d.ts",
"!**/node_modules/**"
],
"coverageReporters": [
"lcovonly",
"text"
]
"testRunner": "jest-circus/runner",
"testEnvironment": "node",
"testRegex": "/test/.*\\.spec\\.(jsx?|tsx?)$",
"transform": {
"^.+\\.(jsx?|tsx?)$": "babel-jest"
},
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!**/*.d.ts",
"!**/node_modules/**"
],
"coverageReporters": [
"lcovonly",
"text"
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"node": ">=10.0.0"
},
"scripts": {
"lint": "eslint --cache 'rollup.config.js' 'src/**/*.ts' 'test/**/*.{js,ts}'",
"lint": "eslint 'rollup.config.js' 'src/**/*.ts' 'types/**/*.ts' 'test/**/*.{js,ts}'",
"jest": "cross-env NODE_ENV=test jest -c jest.config.json",
"jest:debug": "cross-env NODE_ENV=test node --inspect node_modules/.bin/jest --watch --no-cache --runInBand -c jest.config.json",
"typecheck": "tsc --noEmit --pretty --skipLibCheck",
Expand Down Expand Up @@ -91,7 +91,7 @@
"@size-limit/preset-small-lib": "^4.4.0",
"@trigen/babel-preset": "^7.0.2",
"@trigen/browserslist-config": "^7.0.2",
"@trigen/eslint-config": "^7.0.6",
"@trigen/eslint-config": "^8.0.0-alpha.6",
"@types/jest": "^27.0.2",
"@types/node": "^17.0.15",
"@types/node-fetch": "^3.0.3",
Expand Down

0 comments on commit 92f7866

Please sign in to comment.