Skip to content

Commit c5d9f91

Browse files
committed
style(ios): add swift linting
1 parent 2b4aa7b commit c5d9f91

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

.swiftlint.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
disabled_rules: # rule identifiers to exclude from running
2+
- orphaned_doc_comment
3+
- line_length
4+
- identifier_name
5+
included: # paths to include during linting. `--path` is ignored if present.
6+
- iphone/Classes
7+

lint-staged.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = {
1818
'iphone/**/*.{m,h}': [
1919
'npx clang-format -style=file -i'
2020
],
21+
'iphone/Classes/**/*.swift': [
22+
'swiftlint autocorrect'
23+
],
2124
'iphone/TitaniumKit/TitaniumKit/Sources/API/TopTiModule.m': [
2225
'npm run ios-sanity-check --'
2326
],

package.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,21 @@
3636
"deprecations": "npm run docs:deprecated",
3737
"docs:deprecated": "./build/scons deprecations",
3838
"docs:removed": "./build/scons removals 7.0.0",
39-
"format": "npm-run-all --parallel format:**",
39+
"format": "npm-run-all --parallel format:!\\(ios\\|android\\)",
4040
"format:android": "echo Formatting Android code is not supported.",
41-
"format:ios": "npm run lint:ios -- --fix",
41+
"format:ios": "npm-run-all --parallel format:objc format:swift",
42+
"format:objc": "npm run lint:objc -- --fix",
43+
"format:swift": "npm run lint:swift -- autocorrect",
4244
"format:js": "npm run lint:js -- --fix",
4345
"ios": "./build/scons cleanbuild ios",
4446
"ios-sanity-check": "./build/scons check-ios-toplevel",
4547
"link": "npm run deploy -- --symlink",
46-
"lint": "npm-run-all --parallel lint:**",
48+
"lint": "npm-run-all --parallel lint:!\\(ios\\)",
4749
"lint:android": "./android/gradlew checkJavaStyle -p ./android --console plain",
4850
"lint:docs": "tdoc-validate ./apidoc",
49-
"lint:ios": "clang-format-lint $npm_package_config_format_ios",
51+
"lint:ios": "npm-run-all --parallel lint:objc lint:swift",
52+
"lint:objc": "clang-format-lint $npm_package_config_format_objc",
53+
"lint:swift": "swiftlint",
5054
"lint:js": "eslint .",
5155
"lint:lockfile": "./build/scons check-lockfile",
5256
"package": "./build/scons package",
@@ -76,8 +80,7 @@
7680
"path": "./node_modules/cz-conventional-changelog"
7781
},
7882
"format": {
79-
"android": "android/!(app|templates)/**/*.java",
80-
"ios": "iphone/Classes/*.{m,h} iphone/Classes/Layout/*.{m,h} iphone/TitaniumKit/TitaniumKit/*.h iphone/TitaniumKit/TitaniumKit/Sources/**/*.{m,h}"
83+
"objc": "iphone/Classes/*.{m,h} iphone/Classes/Layout/*.{m,h} iphone/TitaniumKit/TitaniumKit/*.h iphone/TitaniumKit/TitaniumKit/Sources/**/*.{m,h}"
8184
}
8285
},
8386
"dependencies": {

0 commit comments

Comments
 (0)