Skip to content

Commit

Permalink
fix: switch to serwist for PWA support
Browse files Browse the repository at this point in the history
  • Loading branch information
JanStevens committed Mar 7, 2024
1 parent 0a82bb1 commit 9fb0d7c
Show file tree
Hide file tree
Showing 16 changed files with 1,366 additions and 2,623 deletions.
60 changes: 56 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
{
"extends": ["next/core-web-vitals", "plugin:prettier/recommended"],
"plugins": ["prettier", "simple-import-sort", "@typescript-eslint"],
"extends": [
"next/core-web-vitals",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended"
],
"plugins": [
"prettier",
"simple-import-sort",
"no-relative-import-paths",
"deprecation",
"@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.eslint.json",
"tsconfigRootDir": "./"
},
"settings": {
"import/resolver": {
"typescript": true,
"node": true
}
},
"rules": {
"object-curly-spacing": ["warn", "always"],
"import/no-anonymous-default-export": "off",
"react/jsx-key": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/style-prop-object": "off",
"no-unused-vars": "off",
"no-console": ["warn", { "allow": ["warn", "error", "info"] }],
"@typescript-eslint/no-explicit-any": "error",
Expand All @@ -14,8 +40,22 @@
"allowSingleExtends": false
}
],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/array-type": ["warn"],
"@typescript-eslint/no-non-null-assertion": ["warn"],
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": false
}
],
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/unbound-method": ["error", { "ignoreStatic": true }],
"@typescript-eslint/no-unused-vars": [
"warn",
{
Expand Down Expand Up @@ -47,6 +87,18 @@
]
}
],
"simple-import-sort/exports": "warn"
"import/no-anonymous-default-export": "off",
"simple-import-sort/exports": "warn",
"import/no-useless-path-segments": ["error", { "noUselessIndex": true }],
"import/no-duplicates": [
"warn",
{
"prefer-inline": true
}
],
"no-relative-import-paths/no-relative-import-paths": [
"warn",
{ "allowSameFolder": true, "rootDir": "src" }
]
}
}
13 changes: 8 additions & 5 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import withPWAInit from '@ducanh2912/next-pwa';
/* eslint-disable @typescript-eslint/no-unsafe-call */
import withSerwistInit from '@serwist/next';

const withPWA = withPWAInit({
dest: 'public',
const withPWA = withSerwistInit({
swSrc: 'src/app/sw.ts',
swDest: 'public/sw.js',
cacheOnFrontEndNav: true,
cacheStartUrl: true,
aggressiveFrontEndNavCaching: true,
additionalPrecacheEntries: [
{ url: '/scenario/2', revision: process.env.npm_package_version },
],
});

const securityHeaders = [
Expand Down
Loading

0 comments on commit 9fb0d7c

Please sign in to comment.