diff --git a/.eslintrc b/.eslintrc index 6501cb73..6b80ad4e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -15,10 +15,10 @@ "plugin:@typescript-eslint/recommended", "plugin:jsx-a11y/recommended", "prettier/@typescript-eslint", + "prettier/react", "plugin:prettier/recommended", "plugin:react/recommended" ], - "plugins": ["@typescript-eslint", "react", "graphql", "jsx-a11y"], "rules": { "object-curly-spacing": ["error", "always"], "react/prop-types": "off", @@ -26,9 +26,11 @@ "@typescript-eslint/no-explicit-any": "off" }, "parserOptions": { - "ecmaFeatures": { "jsx": true }, "ecmaVersion": 2018, "sourceType": "module", + "ecmaFeatures": { + "jsx": true + }, "project": "./tsconfig.json" } } diff --git a/package.json b/package.json index da5e4da6..bb1e0ed9 100644 --- a/package.json +++ b/package.json @@ -12,18 +12,20 @@ "ssr": "npm run build && serve -s public/", "test": "npm run lint && jest --coverage", "test:watch": "npm run lint && jest --coverage --watch", - "rename:scrypt": "sed -i -e 's|./build/Release/scrypt|scrypt|g' node_modules/scrypt/index.js", "copy": "cp -R content/media/ public", "lint": "run-p --continue-on-error lint:js lint:css lint:md", "lint:js": "eslint --ignore-path .gitignore --ext .js,.jsx,.ts,.tsx .", "lint:css": "stylelint 'src/**/*.{css,scss}'", "lint:md": "markdownlint './**/*.{md,markdown}' --ignore './{node_modules,public,.cache,.git,coverage}/**/*'", - "format": "npm run lint:js -- --fix && npm run lint:css -- --fix", + "format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,md,json,css,scss}'", "deploy": "./scripts/deploy.sh", "new": "babel-node ./scripts/new.js" }, "browserslist": [ - "last 2 versions" + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" ], "dependencies": { "dms2dec": "^1.1.0", diff --git a/src/@types/declarations.d.ts b/src/@types/declarations.d.ts deleted file mode 100644 index 31eab8bc..00000000 --- a/src/@types/declarations.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare module '*.scss' { - const content: { [className: string]: string } - export = content -} - -/* eslint-disable-next-line @typescript-eslint/no-empty-interface */ -interface SvgrComponent - extends React.StatelessComponent> {} - -declare module '*.svg' { - const value: SvgrComponent - export default value -} diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts new file mode 100644 index 00000000..5925eaf8 --- /dev/null +++ b/src/@types/global.d.ts @@ -0,0 +1,23 @@ +interface CSSModule { + [className: string]: string +} + +// type shims for CSS modules +declare module '*.module.scss' { + const cssModule: CSSModule + export = cssModule +} + +declare module '*.module.css' { + const cssModule: CSSModule + export = cssModule +} + +/* eslint-disable-next-line @typescript-eslint/no-empty-interface */ +interface SvgrComponent + extends React.StatelessComponent> {} + +declare module '*.svg' { + const value: SvgrComponent + export default value +} diff --git a/tsconfig.json b/tsconfig.json index 46ad7239..82dced8a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,17 @@ { "compilerOptions": { - "outDir": "./dist/", - "sourceMap": true, - "noImplicitAny": true, - "esModuleInterop": true, "module": "commonjs", "target": "esnext", + "jsx": "preserve", + "lib": ["dom", "es2015", "es2017"], "strict": true, - "jsx": "react", - "lib": ["dom", "esnext"], - "noEmit": true + "noEmit": true, + "isolatedModules": true, + "esModuleInterop": true, + "skipLibCheck": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "preserveConstEnums": true }, "exclude": ["node_modules", "public", ".cache", "*.js"], "include": ["./src/**/*"]