Skip to content

Commit f00da2f

Browse files
committed
Add Prettier and ESLint config, update dependencies
Added .prettierrc.js and eslint.config.mts for code formatting and linting. Upgraded Yarn to 4.10.3 and updated .yarnrc.yml and package.json. Made code and dependency updates in android, example, and src files to align with new tooling.
1 parent 0282703 commit f00da2f

10 files changed

Lines changed: 6477 additions & 4196 deletions

File tree

.prettierrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
singleQuote: true,
3+
trailingComma: 'all',
4+
printWidth: 100,
5+
};

.yarn/releases/yarn-4.10.3.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
compressionLevel: mixed
2+
3+
enableGlobalCache: false
4+
15
nodeLinker: node-modules
6+
7+
yarnPath: .yarn/releases/yarn-4.10.3.cjs

android/src/main/java/com/sensitiveinfo/internal/storage/PersistedEntry.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ internal data class PersistedEntry(
7676
return null
7777
}
7878

79-
val ciphertext = json.optString(KEY_CIPHERTEXT, null)?.let { Base64.decode(it, Base64.NO_WRAP) }
80-
val iv = json.optString(KEY_IV, null)?.let { Base64.decode(it, Base64.NO_WRAP) }
79+
val ciphertextEncoded = json.optString(KEY_CIPHERTEXT, "")
80+
val ciphertext = ciphertextEncoded.takeIf { it.isNotEmpty() }?.let { Base64.decode(it, Base64.NO_WRAP) }
81+
val ivEncoded = json.optString(KEY_IV, "")
82+
val iv = ivEncoded.takeIf { it.isNotEmpty() }?.let { Base64.decode(it, Base64.NO_WRAP) }
8183
val authenticators = json.optInt(KEY_AUTHENTICATORS, 0)
8284
val requiresAuth = json.optBoolean(KEY_REQUIRES_AUTH, false)
8385
val invalidateOnEnrollment = json.optBoolean(KEY_INVALIDATE_ON_ENROLLMENT, false)

eslint.config.mts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
3+
import { fixupPluginRules } from '@eslint/compat';
4+
import { FlatCompat } from '@eslint/eslintrc';
5+
import js from '@eslint/js';
6+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
7+
import tsParser from '@typescript-eslint/parser';
8+
import importHelpers from 'eslint-plugin-import-helpers';
9+
import prettier from 'eslint-plugin-prettier';
10+
import react from 'eslint-plugin-react';
11+
import reactHooks from 'eslint-plugin-react-hooks';
12+
import globals from 'globals';
13+
import path from 'node:path';
14+
import { fileURLToPath } from 'node:url';
15+
16+
const __filename = fileURLToPath(import.meta.url);
17+
const __dirname = path.dirname(__filename);
18+
19+
const compat = new FlatCompat({
20+
baseDirectory: __dirname,
21+
recommendedConfig: js.configs.recommended,
22+
allConfig: js.configs.all,
23+
});
24+
25+
export default [
26+
...compat.extends(
27+
'plugin:react/recommended',
28+
'airbnb',
29+
'plugin:@typescript-eslint/recommended',
30+
'prettier',
31+
),
32+
{
33+
plugins: {
34+
react,
35+
'react-hooks': fixupPluginRules(reactHooks),
36+
'@typescript-eslint': typescriptEslint,
37+
prettier,
38+
'import-helpers': importHelpers,
39+
},
40+
41+
languageOptions: {
42+
globals: {
43+
...globals.browser,
44+
...globals.node,
45+
__DEV__: 'readonly',
46+
console: 'readonly',
47+
},
48+
49+
parser: tsParser,
50+
ecmaVersion: 'latest',
51+
sourceType: 'module',
52+
53+
parserOptions: {
54+
ecmaFeatures: {
55+
jsx: true,
56+
},
57+
},
58+
},
59+
60+
settings: {
61+
'import/resolver': {
62+
typescript: {},
63+
},
64+
},
65+
66+
rules: {
67+
'prettier/prettier': 'error',
68+
},
69+
},
70+
];

0 commit comments

Comments
 (0)