Skip to content

Commit e49a5d3

Browse files
authored
chore: code linting formating (#101)
* feat(ios): support custom selection menus * chore: formatting and linting code
1 parent f88aee7 commit e49a5d3

14 files changed

Lines changed: 637 additions & 453 deletions

bun.lock

Lines changed: 190 additions & 148 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.mjs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { defineConfig } from "eslint/config";
2+
import eslint from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
import react from 'eslint-plugin-react';
5+
import reactHooks from 'eslint-plugin-react-hooks';
6+
import reactNative from 'eslint-plugin-react-native';
7+
import prettierPlugin from 'eslint-plugin-prettier';
8+
import prettierConfig from 'eslint-config-prettier';
9+
import nitroModulesPlugin from 'eslint-plugin-nitro-modules';
10+
11+
export default defineConfig([
12+
eslint.configs.recommended,
13+
nitroModulesPlugin.configs.recommended,
14+
...tseslint.configs.recommended,
15+
prettierConfig,
16+
{
17+
files: ['src/**/*.{js,jsx,ts,tsx}'],
18+
languageOptions: {
19+
ecmaVersion: 2024,
20+
sourceType: 'module',
21+
parserOptions: {
22+
ecmaFeatures: {
23+
jsx: true,
24+
},
25+
},
26+
},
27+
plugins: {
28+
react,
29+
'react-hooks': reactHooks,
30+
'react-native': reactNative,
31+
prettier: prettierPlugin
32+
},
33+
rules: {
34+
...react.configs['jsx-runtime'].rules,
35+
...reactHooks.configs.recommended.rules,
36+
'react/react-in-jsx-scope': 'off',
37+
'react/prop-types': 'off',
38+
'@typescript-eslint/no-explicit-any': 'warn',
39+
"@typescript-eslint/no-empty-object-type": "off",
40+
"@typescript-eslint/no-require-imports": "off",
41+
'@typescript-eslint/no-unused-vars': [
42+
'warn',
43+
{
44+
argsIgnorePattern: '^_',
45+
varsIgnorePattern: '^_',
46+
},
47+
],
48+
'react-hooks/rules-of-hooks': 'error',
49+
'react-hooks/exhaustive-deps': 'warn',
50+
51+
'prettier/prettier': [
52+
'warn',
53+
{
54+
"quoteProps": "consistent",
55+
"singleQuote": true,
56+
"tabWidth": 4,
57+
"trailingComma": "es5",
58+
"useTabs": false,
59+
"semi": false
60+
},
61+
],
62+
},
63+
settings: {
64+
react: {
65+
version: 'detect',
66+
},
67+
},
68+
},
69+
{
70+
ignores: [
71+
'node_modules/**',
72+
'lib/**',
73+
'build/**',
74+
'example/**',
75+
'nitrogen/generated/**',
76+
'android/**',
77+
'ios/**',
78+
'cpp/**',
79+
'*.config.js',
80+
'*.config.mjs',
81+
'*.config.cjs',
82+
'*.podspec',
83+
],
84+
},
85+
]);

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PODS:
88
- hermes-engine (0.81.4):
99
- hermes-engine/Pre-built (= 0.81.4)
1010
- hermes-engine/Pre-built (0.81.4)
11-
- NitroModules (0.31.2):
11+
- NitroModules (0.31.4):
1212
- boost
1313
- DoubleConversion
1414
- fast_float
@@ -2643,7 +2643,7 @@ SPEC CHECKSUMS:
26432643
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
26442644
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
26452645
hermes-engine: 35c763d57c9832d0eef764316ca1c4d043581394
2646-
NitroModules: 2862238ccf1a30c3e3c20fb10ae297ce26168718
2646+
NitroModules: a08d4fbf973527df2d061c5f02cb192c2c261a09
26472647
NitroText: c95604214333634a6a083ac7211b238686dbd628
26482648
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
26492649
RCTDeprecation: c0ed3249a97243002615517dff789bf4666cf585

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"react": "19.1.0",
1515
"react-native": "0.81.4",
1616
"react-native-safe-area-context": "^5.5.2",
17-
"react-native-nitro-modules": "^0.31.2"
17+
"react-native-nitro-modules": "^0.31.4"
1818
},
1919
"devDependencies": {
2020
"@babel/core": "^7.25.2",

nitrogen/generated/ios/c++/HybridNitroTextSpecSwift.hpp

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nitrogen/generated/ios/swift/HybridNitroTextSpec.swift

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nitrogen/generated/ios/swift/HybridNitroTextSpec_cxx.swift

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 110 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,114 @@
11
{
2-
"name": "react-native-nitro-text",
3-
"version": "1.0.3",
4-
"description": "A Text component that is much richer and performant for both iOS and Android.",
5-
"main": "./lib/commonjs/index.js",
6-
"module": "./lib/module/index.js",
7-
"types": "./lib/typescript/src/index.d.ts",
8-
"react-native": "src/index",
9-
"source": "src/index",
10-
"scripts": {
11-
"typecheck": "tsc --noEmit",
12-
"clean": "git clean -dfX",
13-
"release": "semantic-release",
14-
"build": "bun run typecheck && bob build",
15-
"codegen": "nitrogen --logLevel=\"debug\" && bun run build",
16-
"postcodegen": "bun --cwd example pod"
17-
},
18-
"keywords": [
19-
"react-native",
20-
"react-native-nitro-text"
21-
],
22-
"files": [
23-
"src",
24-
"react-native.config.js",
25-
"lib",
26-
"nitrogen",
27-
"cpp",
28-
"nitro.json",
29-
"android/build.gradle",
30-
"android/fix-prefab.gradle",
31-
"android/gradle.properties",
32-
"android/CMakeLists.txt",
33-
"android/src",
34-
"ios/**/*.h",
35-
"ios/**/*.hpp",
36-
"ios/**/*.m",
37-
"ios/**/*.mm",
38-
"ios/**/*.cpp",
39-
"ios/**/*.swift",
40-
"app.plugin.js",
41-
"*.podspec",
42-
"README.md"
43-
],
44-
"workspaces": [
45-
"example"
46-
],
47-
"repository": "https://github.com/patrickkabwe/react-native-nitro-text.git",
48-
"author": "Patrick Kabwe",
49-
"license": "MIT",
50-
"bugs": "https://github.com/patrickkabwe/react-native-nitro-text/issues",
51-
"homepage": "https://github.com/patrickkabwe/react-native-nitro-text#readme",
52-
"publishConfig": {
53-
"access": "public",
54-
"registry": "https://registry.npmjs.org/"
55-
},
56-
"devDependencies": {
57-
"@jamesacarr/eslint-formatter-github-actions": "^0.2.0",
58-
"@semantic-release/changelog": "^6.0.3",
59-
"@semantic-release/git": "^10.0.1",
60-
"@types/jest": "^29.5.12",
61-
"@types/react": "19.1.0",
62-
"nitrogen": "^0.31.2",
63-
"react": "19.1.0",
64-
"react-native": "0.81.4",
65-
"react-native-builder-bob": "^0.37.0",
66-
"react-native-nitro-modules": "^0.31.2",
67-
"conventional-changelog-conventionalcommits": "^9.1.0",
68-
"semantic-release": "^24.2.8",
69-
"typescript": "^5.8.3"
70-
},
71-
"peerDependencies": {
72-
"react": "*",
73-
"react-native": "*",
74-
"react-native-nitro-modules": "*"
75-
},
76-
"eslintConfig": {
77-
"root": true,
78-
"extends": [
79-
"@react-native",
80-
"prettier"
2+
"name": "react-native-nitro-text",
3+
"version": "1.0.3",
4+
"description": "A Text component that is much richer and performant for both iOS and Android.",
5+
"main": "./lib/commonjs/index.js",
6+
"module": "./lib/module/index.js",
7+
"types": "./lib/typescript/src/index.d.ts",
8+
"react-native": "src/index",
9+
"source": "src/index",
10+
"scripts": {
11+
"typecheck": "tsc --noEmit",
12+
"lint": "eslint src",
13+
"lint:fix": "eslint src --fix",
14+
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,md}\"",
15+
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,md}\"",
16+
"clean": "git clean -dfX",
17+
"release": "semantic-release",
18+
"build": "bun run typecheck && bob build",
19+
"codegen": "nitrogen --logLevel=\"debug\" && bun run build",
20+
"postcodegen": "bun --cwd example pod"
21+
},
22+
"keywords": [
23+
"react-native",
24+
"react-native-nitro-text"
8125
],
82-
"plugins": [
83-
"prettier"
26+
"files": [
27+
"src",
28+
"react-native.config.js",
29+
"lib",
30+
"nitrogen",
31+
"cpp",
32+
"nitro.json",
33+
"android/build.gradle",
34+
"android/fix-prefab.gradle",
35+
"android/gradle.properties",
36+
"android/CMakeLists.txt",
37+
"android/src",
38+
"ios/**/*.h",
39+
"ios/**/*.hpp",
40+
"ios/**/*.m",
41+
"ios/**/*.mm",
42+
"ios/**/*.cpp",
43+
"ios/**/*.swift",
44+
"app.plugin.js",
45+
"*.podspec",
46+
"README.md"
8447
],
85-
"rules": {
86-
"prettier/prettier": [
87-
"warn",
88-
{
89-
"quoteProps": "consistent",
90-
"singleQuote": true,
91-
"tabWidth": 2,
92-
"trailingComma": "es5",
93-
"useTabs": false
94-
}
95-
]
48+
"workspaces": [
49+
"example"
50+
],
51+
"repository": "https://github.com/patrickkabwe/react-native-nitro-text.git",
52+
"author": "Patrick Kabwe",
53+
"license": "MIT",
54+
"bugs": "https://github.com/patrickkabwe/react-native-nitro-text/issues",
55+
"homepage": "https://github.com/patrickkabwe/react-native-nitro-text#readme",
56+
"publishConfig": {
57+
"access": "public",
58+
"registry": "https://registry.npmjs.org/"
59+
},
60+
"devDependencies": {
61+
"@eslint/js": "^9.38.0",
62+
"@jamesacarr/eslint-formatter-github-actions": "^0.2.0",
63+
"@react-native/eslint-config": "0.81.4",
64+
"@semantic-release/changelog": "^6.0.3",
65+
"@semantic-release/git": "^10.0.1",
66+
"@types/jest": "^29.5.12",
67+
"@types/react": "19.1.0",
68+
"@typescript-eslint/eslint-plugin": "^8.46.2",
69+
"@typescript-eslint/parser": "^8.46.2",
70+
"conventional-changelog-conventionalcommits": "^9.1.0",
71+
"eslint": "^9.38.0",
72+
"eslint-config-prettier": "^10.1.8",
73+
"eslint-plugin-prettier": "^5.5.4",
74+
"eslint-plugin-react": "^7.37.5",
75+
"eslint-plugin-react-hooks": "^7.0.1",
76+
"eslint-plugin-react-native": "^5.0.0",
77+
"nitrogen": "^0.31.4",
78+
"prettier": "^3.6.2",
79+
"react": "19.1.0",
80+
"react-native": "0.81.4",
81+
"react-native-builder-bob": "^0.37.0",
82+
"react-native-nitro-modules": "^0.31.4",
83+
"semantic-release": "^24.2.8",
84+
"typescript": "^5.8.3",
85+
"typescript-eslint": "^8.46.2"
86+
},
87+
"peerDependencies": {
88+
"react": "*",
89+
"react-native": "*",
90+
"react-native-nitro-modules": "*"
91+
},
92+
"prettier": {
93+
"quoteProps": "consistent",
94+
"singleQuote": true,
95+
"tabWidth": 4,
96+
"trailingComma": "es5",
97+
"useTabs": false,
98+
"semi": false
99+
},
100+
"react-native-builder-bob": {
101+
"source": "src",
102+
"output": "lib",
103+
"targets": [
104+
"commonjs",
105+
"module",
106+
[
107+
"typescript",
108+
{
109+
"project": "tsconfig.json"
110+
}
111+
]
112+
]
96113
}
97-
},
98-
"eslintIgnore": [
99-
"node_modules/",
100-
"lib/"
101-
],
102-
"prettier": {
103-
"quoteProps": "consistent",
104-
"singleQuote": true,
105-
"tabWidth": 2,
106-
"trailingComma": "es5",
107-
"useTabs": false,
108-
"semi": false
109-
},
110-
"react-native-builder-bob": {
111-
"source": "src",
112-
"output": "lib",
113-
"targets": [
114-
"commonjs",
115-
"module",
116-
[
117-
"typescript",
118-
{
119-
"project": "tsconfig.json"
120-
}
121-
]
122-
]
123-
}
124-
}
114+
}

0 commit comments

Comments
 (0)