Skip to content

Commit

Permalink
integrate prettier with eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysVuika committed Dec 14, 2024
1 parent 551228d commit 33aed47
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none"
"trailingComma": "es5"
}
4 changes: 3 additions & 1 deletion lib/src/translateProvider.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ describe('TranslateProvider', () => {
global.fetch = jest.fn().mockImplementation(() => {
return Promise.resolve({
ok: true,
json: () => { /* */ },
json: () => {
/* */
},
});
});
});
Expand Down
16 changes: 8 additions & 8 deletions lib/src/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Utils', () => {
const template = 'Good luck, {param1} {param2}!';
const params = {
param1: 'Mr.',
param2: 'Gorsky'
param2: 'Gorsky',
};

const value = format(template, params);
Expand Down Expand Up @@ -61,9 +61,9 @@ describe('Utils', () => {
const data = {
en: {
messages: {
404: 'Error, not found.'
}
}
404: 'Error, not found.',
},
},
};

const value = getValue(data, 'en', 'messages.404');
Expand All @@ -73,8 +73,8 @@ describe('Utils', () => {
test('returns original key if nested value not found', () => {
const data = {
en: {
messages: {}
}
messages: {},
},
};

const value = getValue(data, 'en', 'messages.500');
Expand All @@ -84,8 +84,8 @@ describe('Utils', () => {
test('supports tol-level values with dots', () => {
const data = {
en: {
'messages.errors.500': 'Aw, snap!'
}
'messages.errors.500': 'Aw, snap!',
},
};

const value = getValue(data, 'en', 'messages.errors.500');
Expand Down
103 changes: 103 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,28 @@
"build": "preact build",
"serve": "preact build && preact serve",
"dev": "preact watch",
"lint": "npm run format:check && eslint lib",
"lint": "eslint lib",
"build.lib": "rollup -c && npm run copy:modules && cp -r README.md dist",
"build.lib.dev": "rollup -c -w",
"copy:modules": "rm -rf node_modules/@denysvuika && mkdir -p node_modules/@denysvuika/preact-translate && cp -r dist/* node_modules/@denysvuika/preact-translate",
"size": "size-limit",
"test": "jest --coverage",
"test:watch": "jest --watchAll",
"format:check": "prettier --check \"./**/*.{ts,js,css,scss,html}\"",
"format:fix": "prettier --write \"./**/*.{ts,js,css,scss,html}\""
"test:watch": "jest --watchAll"
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
"extends": [
"preact",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"ignorePatterns": [
"build/"
]
],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
},
"devDependencies": {
"@size-limit/preset-small-lib": "^4.12.0",
Expand All @@ -48,6 +51,8 @@
"@typescript-eslint/parser": "^5.54.0",
"eslint": "^8.35.0",
"eslint-config-preact": "^1.3.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"if-env": "^1.0.4",
"jest": "^29.7.0",
"jest-preset-preact": "^4.1.1",
Expand Down

0 comments on commit 33aed47

Please sign in to comment.