Skip to content
Open
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
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

33 changes: 0 additions & 33 deletions .eslintrc.js

This file was deleted.

5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ updates:
schedule:
interval: 'weekly'
groups:
update-eslint:
patterns:
- 'eslint'
- 'eslint-*'
- '@eslint/*'
update-textlint:
patterns:
- 'textlint'
Expand Down
6 changes: 0 additions & 6 deletions .prettierrc.js

This file was deleted.

3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"],
"unwantedRecommendations": ["eg2.tslint"]
"recommendations": ["biomejs.biome", "streetsidesoftware.code-spell-checker"]
}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
},
"cSpell.words": [
"Consts",
"cooldown",
Expand Down
942 changes: 0 additions & 942 deletions .yarn/releases/yarn-4.10.3.cjs

This file was deleted.

1,000 changes: 1,000 additions & 0 deletions .yarn/releases/yarn-4.18.0.cjs

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
compressionLevel: mixed

enableGlobalCache: false

nmHoistingLimits: workspaces
enableScripts: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.10.3.cjs
npmMinimalAgeGate: 3d

yarnPath: .yarn/releases/yarn-4.18.0.cjs
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ To run the example app on iOS:
yarn example ios
```

Make sure your code passes TypeScript and ESLint. Run the following to verify:
Make sure your code passes TypeScript and Biome. Run the following to verify:

```sh
yarn typecheck
Expand Down Expand Up @@ -81,9 +81,9 @@ Our pre-commit hooks verify that your commit message matches this format when co

### Linting and tests

[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
[Biome](https://github.com/biomejs/biome), [TypeScript](https://www.typescriptlang.org/)

We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [Biome](https://github.com/biomejs/biome) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.

Our pre-commit hooks verify that the linter and tests pass when committing.

Expand All @@ -103,7 +103,7 @@ The `package.json` file contains various scripts for common tasks:

- `yarn`: setup project by installing dependencies and pods - run with `POD_INSTALL=0` to skip installing pods.
- `yarn typecheck`: type-check files with TypeScript.
- `yarn lint`: lint files with ESLint.
- `yarn lint`: lint files with Biome.
- `yarn test`: run unit tests with Jest.
- `yarn example start`: start the Metro server for the example app.
- `yarn example android`: run the example app on Android.
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
}
56 changes: 56 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"includes": [
"**/*.md",
"**/*.js",
"**/*.ts",
"**/*.json",
"**/*.yml",
"**/*.yaml",
"!node_modules",
"!android",
"!ios",
"!build",
"!.expo",
"!coverage"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"preset": "recommended",
"style": {
"useNodejsImportProtocol": "off"
},
"suspicious": {
"noArrayIndexKey": "warn"
}
}
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single",
"jsxQuoteStyle": "double"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}
6 changes: 3 additions & 3 deletions example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const pak = require('../package.json');
const path = require('path')
const pak = require('../package.json')

module.exports = {
presets: ['module:@react-native/babel-preset'],
Expand All @@ -14,4 +14,4 @@ module.exports = {
},
],
],
};
}
8 changes: 4 additions & 4 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppRegistry } from 'react-native';
import App from './src/App';
import { name as appName } from './app.json';
import { AppRegistry } from 'react-native'
import { name as appName } from './app.json'
import App from './src/App'

AppRegistry.registerComponent(appName, () => App);
AppRegistry.registerComponent(appName, () => App)
2 changes: 1 addition & 1 deletion example/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
preset: 'react-native',
};
}
8 changes: 5 additions & 3 deletions example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config')
const path = require('path')
const escape = require('escape-string-regexp')
const escapeStringRegexp = require('escape-string-regexp')
const exclusionList = require('metro-config/src/defaults/exclusionList')
const pak = require('../package.json')

Expand All @@ -22,8 +22,10 @@ const config = {
blacklistRE: exclusionList(
modules.map(
(m) =>
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
)
new RegExp(
`^${escapeStringRegexp(path.join(root, 'node_modules', m))}\\/.*$`,
),
),
),

extraNodeModules: modules.reduce((acc, name) => {
Expand Down
3 changes: 1 addition & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@react-native-community/cli-platform-android": "^18.0.0",
"@react-native-community/cli-platform-ios": "^18.0.0",
"@react-native/babel-preset": "0.79.2",
"@react-native/eslint-config": "0.79.2",
"@react-native/metro-config": "0.79.2",
"@react-native/typescript-config": "0.79.2",
"@types/jest": "^29.5.14",
Expand All @@ -39,5 +38,5 @@
"engines": {
"node": ">=18"
},
"packageManager": "yarn@4.9.1"
"packageManager": "yarn@4.18.0"
}
6 changes: 3 additions & 3 deletions example/react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const path = require('path');
const pak = require('../package.json');
const path = require('path')
const pak = require('../package.json')

module.exports = {
dependencies: {
[pak.name]: {
root: path.join(__dirname, '..'),
},
},
};
}
9 changes: 6 additions & 3 deletions example/src/SampleResource.ts

Large diffs are not rendered by default.

36 changes: 4 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"example": "yarn workspace react-native-sunmi-printer-library-example",
"test": "jest",
"typecheck": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"lint": "biome check",
"lint-force": "biome check --write",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepare": "bob build",
"release": "release-it",
Expand All @@ -53,21 +54,15 @@
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {
"@react-native/eslint-config": "^0.74.85",
"@biomejs/biome": "^2.5.6",
"@release-it/conventional-changelog": "^8.0.1",
"@types/jest": "^29.5.12",
"@types/react": "^19.1.2",
"@types/react-native": "^0.73.0",
"@types/react-test-renderer": "^19.1.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"del-cli": "^5.1.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-react": "^7.30.1",
"jest": "^29.7.0",
"metro-react-native-babel-preset": "^0.77.0",
"prettier": "^2.8.8",
"react": "19.0.0",
"react-native": "0.79.2",
"react-native-builder-bob": "^0.26.0",
Expand All @@ -83,7 +78,7 @@
"workspaces": [
"example"
],
"packageManager": "yarn@4.10.3",
"packageManager": "yarn@4.18.0",
"engines": {
"node": ">= 18.0.0"
},
Expand Down Expand Up @@ -111,29 +106,6 @@
}
}
},
"eslintConfig": {
"root": true,
"extends": [
"@react-native",
"prettier"
],
"rules": {
"prettier/prettier": [
"error",
{
"quoteProps": "consistent",
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
]
}
},
"eslintIgnore": [
"node_modules/",
"lib/"
],
"prettier": {
"quoteProps": "consistent",
"singleQuote": true,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('SunmiPrinterLibrary', () => {
const text = 'こんにちは、プリンター!'
await printText(text)
expect(NativeModules.SunmiPrinterLibrary.printText).toHaveBeenCalledWith(
text
text,
)
})

Expand Down
Loading