🚨 Format and lint files

This commit is contained in:
RaviAnand Mohabir 2021-05-21 15:13:23 +02:00
parent 7582c75699
commit 7745dba5f9
6 changed files with 82 additions and 78 deletions

View File

@ -6,17 +6,18 @@ const mode = process.env.NODE_ENV;
const dev = mode === "development"; const dev = mode === "development";
module.exports = { module.exports = {
plugins: [ plugins: [
// Some plugins, like postcss-nested, need to run before Tailwind // Some plugins, like postcss-nested, need to run before Tailwind
tailwindcss,
// But others, like autoprefixer, need to run after
autoprefixer, tailwindcss,
!dev && cssnano({ // But others, like autoprefixer, need to run after
preset: "default",
}), autoprefixer,
],
!dev &&
cssnano({
preset: "default",
}),
],
}; };

View File

@ -1,12 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
%svelte.head% %svelte.head%
</head> </head>
<body> <body>
<div id="svelte">%svelte.body%</div> <div id="svelte">%svelte.body%</div>
</body> </body>
</html> </html>

View File

@ -1,2 +1,5 @@
<h1>Welcome to SvelteKit</h1> <h1>Welcome to SvelteKit</h1>
<p>Visit <a class="text-blue-600 underline" href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p> <p>
Visit <a class="text-blue-600 underline" href="https://kit.svelte.dev">kit.svelte.dev</a> to read the
documentation
</p>

View File

@ -1,19 +1,19 @@
import preprocess from 'svelte-preprocess'; import preprocess from "svelte-preprocess";
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {
// Consult https://github.com/sveltejs/svelte-preprocess // Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors // for more information about preprocessors
preprocess: [ preprocess: [
preprocess({ preprocess({
postcss: true postcss: true,
}), }),
], ],
kit: { kit: {
// hydrate the <div id="svelte"> element in src/app.html // hydrate the <div id="svelte"> element in src/app.html
target: '#svelte' target: "#svelte",
} },
}; };
export default config; export default config;

View File

@ -1,26 +1,26 @@
const { tailwindExtractor } = require("tailwindcss/lib/lib/purgeUnusedStyles"); const { tailwindExtractor } = require("tailwindcss/lib/lib/purgeUnusedStyles");
module.exports = { module.exports = {
mode: "aot", mode: "aot",
purge: { purge: {
content: [ content: ["./src/**/*.{html,js,svelte,ts}"],
"./src/**/*.{html,js,svelte,ts}", options: {
], defaultExtractor: (content) => [
options: { // If this stops working, please open an issue at https://github.com/svelte-add/tailwindcss/issues rather than bothering Tailwind Labs about it
defaultExtractor: (content) => [ ...tailwindExtractor(content),
// If this stops working, please open an issue at https://github.com/svelte-add/tailwindcss/issues rather than bothering Tailwind Labs about it // Match Svelte class: directives (https://github.com/tailwindlabs/tailwindcss/discussions/1731)
...tailwindExtractor(content), ...[...content.matchAll(/(?:class:)*([\w\d-/:%.]+)/gm)].map(
// Match Svelte class: directives (https://github.com/tailwindlabs/tailwindcss/discussions/1731) ([_match, group, ..._rest]) => group,
...[...content.matchAll(/(?:class:)*([\w\d-/:%.]+)/gm)].map(([_match, group, ..._rest]) => group), ),
], ],
}, },
safelist: [/^svelte-[\d\w]+$/], safelist: [/^svelte-[\d\w]+$/],
}, },
theme: { theme: {
extend: {}, extend: {},
}, },
variants: { variants: {
extend: {}, extend: {},
}, },
plugins: [], plugins: [],
}; };

View File

@ -1,30 +1,30 @@
{ {
"compilerOptions": { "compilerOptions": {
"moduleResolution": "node", "moduleResolution": "node",
"module": "es2020", "module": "es2020",
"lib": ["es2020"], "lib": ["es2020"],
"target": "es2019", "target": "es2019",
/** /**
svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
to enforce using \`import type\` instead of \`import\` for Types. to enforce using \`import type\` instead of \`import\` for Types.
*/ */
"importsNotUsedAsValues": "error", "importsNotUsedAsValues": "error",
"isolatedModules": true, "isolatedModules": true,
"resolveJsonModule": true, "resolveJsonModule": true,
/** /**
To have warnings/errors of the Svelte compiler at the correct position, To have warnings/errors of the Svelte compiler at the correct position,
enable source maps by default. enable source maps by default.
*/ */
"sourceMap": true, "sourceMap": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"baseUrl": ".", "baseUrl": ".",
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"paths": { "paths": {
"$lib/*": ["src/lib/*"] "$lib/*": ["src/lib/*"]
} }
}, },
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"] "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
} }