Skip to content

Commit

Permalink
refactor: refactor prettier to apply global config
Browse files Browse the repository at this point in the history
  • Loading branch information
NazimHAli committed Dec 12, 2021
1 parent fc21e2c commit 772b80c
Show file tree
Hide file tree
Showing 28 changed files with 985 additions and 1,104 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "node", "prettier"],
plugins: ["@typescript-eslint", "node", "prettier", "simple-import-sort"],
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
Expand All @@ -27,5 +27,10 @@ module.exports = {
"node/no-unsupported-features/es-syntax": "off",
"node/shebang": "off",
"quotes": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error"
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"cz-conventional-changelog": "3.3.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^25.2.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
Expand Down
30 changes: 15 additions & 15 deletions packages/svelte-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ Prayer times library providing integration support for multiple environments: va

## Features

- Multiple prayer times calculation methods
- Daily, weekly, monthly, yearly tables
- Calculations client-side
- Original version parsed data from Islamic Finder XML endpoints
- Theme support
- Integrations
- Vanilla JS
- WordPress plugin
- Components
- Typescript with interfaces
- Unit tested
- Multiple prayer times calculation methods
- Daily, weekly, monthly, yearly tables
- Calculations client-side
- Original version parsed data from Islamic Finder XML endpoints
- Theme support
- Integrations
- Vanilla JS
- WordPress plugin
- Components
- Typescript with interfaces
- Unit tested

![image](https://user-images.githubusercontent.com/26750288/145725761-cd675172-2e51-4b29-8619-b7ecff02b268.png)

Expand All @@ -40,7 +40,7 @@ Open a PR or issue

[praytimes.org](http://praytimes.org/)

- Detailed [mathemathical calculation explanations](http://praytimes.org/calculation)
- Code references + [multiple libraries](http://praytimes.org/code/)
- Their latest Javascript version is 10+ years old
- I rewrote it with Typescript, added testing, fixed detected type bugs
- Detailed [mathemathical calculation explanations](http://praytimes.org/calculation)
- Code references + [multiple libraries](http://praytimes.org/code/)
- Their latest Javascript version is 10+ years old
- I rewrote it with Typescript, added testing, fixed detected type bugs
8 changes: 4 additions & 4 deletions packages/svelte-app/app.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
runtime: nodejs14

handlers:
- url: /static
static_dir: build
- url: /static
static_dir: build

- url: /.*
script: auto
- url: /.*
script: auto
20 changes: 10 additions & 10 deletions packages/svelte-app/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/src/assets/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Beautiful Salat</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/src/assets/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Beautiful Salat</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
30 changes: 15 additions & 15 deletions packages/svelte-app/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ const { compilerOptions } = require("./tsconfig");
const sharedConfig = require("../../jest.base-config.js");

module.exports = {
...sharedConfig,
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: "<rootDir>/",
}),
moduleDirectories: ["node_modules", "src"],
collectCoverage: true,
collectCoverageFrom: ["<rootDir>/src/utils/*.ts", "!<rootDir>/src/*.d.ts"],
coverageReporters: ["text", "text-summary"],
coverageThreshold: {
global: {
branches: 10,
functions: 10,
lines: 10,
statements: 10,
},
...sharedConfig,
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: "<rootDir>/",
}),
moduleDirectories: ["node_modules", "src"],
collectCoverage: true,
collectCoverageFrom: ["<rootDir>/src/utils/*.ts", "!<rootDir>/src/*.d.ts"],
coverageReporters: ["text", "text-summary"],
coverageThreshold: {
global: {
branches: 10,
functions: 10,
lines: 10,
statements: 10,
},
},
};
162 changes: 81 additions & 81 deletions packages/svelte-app/package.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
{
"name": "@beautiful-salat/svelte-app",
"version": "0.1.0",
"license": "MIT",
"type": "module",
"files": [
"build/**"
"name": "@beautiful-salat/svelte-app",
"version": "0.1.0",
"license": "MIT",
"type": "module",
"files": [
"build/**"
],
"main": "build/index.js",
"scripts": {
"build": "vite build",
"build:watch": "vite build --watch",
"commit": "cz",
"sveltecheck": "svelte-check --tsconfig ./tsconfig.json",
"dev": "vite --host 10.0.0.211 --port 3001",
"test": "yarn test:jest && yarn test:tsc",
"test:jest": "jest",
"test:tsc": "tsc --noEmit",
"semantic-release": "yarn build && semantic-release",
"serve": "vite preview --port 8080"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^4.1.3",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.2",
"@semantic-release/npm": "^8.0.3",
"@semantic-release/release-notes-generator": "^10.0.3",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.31",
"@testing-library/dom": "^8.11.1",
"@tsconfig/svelte": "^2.0.1",
"@types/cssnano": "^4.0.1",
"@types/postcss-import": "^14.0.0",
"@types/tailwindcss": "^2.2.4",
"animate.css": "^4.1.1",
"autoprefixer": "^10.4.0",
"cssnano": "^5.0.12",
"cz-conventional-changelog": "3.3.0",
"husky": "^7.0.4",
"postcss": "^8.4.4",
"postcss-import": "^14.0.2",
"postcss-nested": "^5.0.6",
"postcss-sass": "^0.5.0",
"prettier-plugin-svelte": "^2.5.0",
"sass": "^1.44.0",
"semantic-release": "^18.0.1",
"svelte": "^3.44.2",
"svelte-check": "^2.2.10",
"svelte-preprocess": "^4.7.2",
"tailwindcss": "^2.2.19",
"tslib": "^2.3.1",
"vite": "^2.6.14"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
}
},
"release": {
"branches": [
"master",
"next",
"beta"
],
"main": "build/index.js",
"scripts": {
"build": "vite build",
"build:watch": "vite build --watch",
"commit": "cz",
"sveltecheck": "svelte-check --tsconfig ./tsconfig.json",
"dev": "vite --host 10.0.0.211 --port 3001",
"test": "yarn test:jest && yarn test:tsc",
"test:jest": "jest",
"test:tsc": "tsc --noEmit",
"semantic-release": "yarn build && semantic-release",
"serve": "vite preview --port 8080"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^4.1.3",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.2",
"@semantic-release/npm": "^8.0.3",
"@semantic-release/release-notes-generator": "^10.0.3",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.31",
"@testing-library/dom": "^8.11.1",
"@tsconfig/svelte": "^2.0.1",
"@types/cssnano": "^4.0.1",
"@types/postcss-import": "^14.0.0",
"@types/tailwindcss": "^2.2.4",
"animate.css": "^4.1.1",
"autoprefixer": "^10.4.0",
"cssnano": "^5.0.12",
"cz-conventional-changelog": "3.3.0",
"husky": "^7.0.4",
"postcss": "^8.4.4",
"postcss-import": "^14.0.2",
"postcss-nested": "^5.0.6",
"postcss-sass": "^0.5.0",
"prettier-plugin-svelte": "^2.5.0",
"sass": "^1.44.0",
"semantic-release": "^18.0.1",
"svelte": "^3.44.2",
"svelte-check": "^2.2.10",
"svelte-preprocess": "^4.7.2",
"tailwindcss": "^2.2.19",
"tslib": "^2.3.1",
"vite": "^2.6.14"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": [
"build/**"
]
}
},
"husky": {
"hooks": {
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
}
},
"release": {
"branches": [
"master",
"next",
"beta"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": [
"build/**"
]
}
],
"@semantic-release/npm",
"@semantic-release/git"
]
}
],
"@semantic-release/npm",
"@semantic-release/git"
]
}
}
51 changes: 25 additions & 26 deletions packages/svelte-app/postcss.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@ const purgecss = require("@fullhuman/postcss-purgecss");
const isProd = process.env.NODE_ENV === "production";

module.exports = {
plugins: [
postcssImport,
tailwindcss,
autoprefixer({
grid: false, // Disable IE support
}),
isProd &&
cssnano({
preset: [
"default",
{
discardComments: {
removeAll: true,
},
},
],
}),
isProd &&
purgecss({
keyframes: true,
content: ["./src/**/*.svelte", "./*.html"],
safelist: [/svelte-/, /tailwindcss\/\/base/],
defaultExtractor: (content) =>
content.match(/[A-Za-z0-9-_:/]+/g) || [],
}),
],
plugins: [
postcssImport,
tailwindcss,
autoprefixer({
grid: false, // Disable IE support
}),
isProd &&
cssnano({
preset: [
"default",
{
discardComments: {
removeAll: true,
},
},
],
}),
isProd &&
purgecss({
keyframes: true,
content: ["./src/**/*.svelte", "./*.html"],
safelist: [/svelte-/, /tailwindcss\/\/base/],
defaultExtractor: (content) => content.match(/[A-Za-z0-9-_:/]+/g) || [],
}),
],
};
6 changes: 0 additions & 6 deletions packages/svelte-app/prettier.config.cjs

This file was deleted.

12 changes: 6 additions & 6 deletions packages/svelte-app/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<script lang="ts">
import { PrayerTimes } from "@/utils/PrayerTimes";
import DisplayMonth from "@/components/DisplayMonth.svelte";
import SingleBox from "./components/SingleBox.svelte";
import { PrayerTimes } from "@/utils/PrayerTimes";
import DisplayMonth from "@/components/DisplayMonth.svelte";
import SingleBox from "./components/SingleBox.svelte";
const ptModule = new PrayerTimes("ISNA");
const prayerTimes = ptModule.getPrayerTimes(new Date(), [43, -80], -5);
const ptModule = new PrayerTimes("ISNA");
const prayerTimes = ptModule.getPrayerTimes(new Date(), [43, -80], -5);
</script>

<SingleBox prayerTimes="{Object.entries(prayerTimes)}" />
<SingleBox prayerTimes={Object.entries(prayerTimes)} />

<br />
<br />
Expand Down
Loading

0 comments on commit 772b80c

Please sign in to comment.