Skip to content

Commit 0574a47

Browse files
committed
fixed type problems
1 parent f68faa9 commit 0574a47

32 files changed

+12221
-203
lines changed

.eslintrc.js

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es6: true,
5+
node: true,
6+
},
7+
parser: '@typescript-eslint/parser',
8+
parserOptions: {
9+
project: 'tsconfig.json',
10+
sourceType: 'module',
11+
},
12+
plugins: ['@typescript-eslint'],
13+
extends: ['prettier', 'prettier/react'],
14+
rules: {
15+
'@typescript-eslint/adjacent-overload-signatures': 'warn',
16+
'@typescript-eslint/array-type': 'warn',
17+
'@typescript-eslint/ban-types': 'warn',
18+
'@typescript-eslint/class-name-casing': 'warn',
19+
'@typescript-eslint/consistent-type-assertions': 'warn',
20+
'@typescript-eslint/indent': ['off', 2],
21+
'@typescript-eslint/member-delimiter-style': [
22+
'off',
23+
{
24+
multiline: {
25+
delimiter: 'none',
26+
requireLast: true,
27+
},
28+
singleline: {
29+
delimiter: 'semi',
30+
requireLast: false,
31+
},
32+
},
33+
],
34+
'@typescript-eslint/member-ordering': 'off',
35+
'@typescript-eslint/no-empty-function': 'warn',
36+
'@typescript-eslint/no-empty-interface': 'warn',
37+
'@typescript-eslint/no-explicit-any': 'off',
38+
'@typescript-eslint/no-misused-new': 'warn',
39+
'@typescript-eslint/no-namespace': 'warn',
40+
'@typescript-eslint/no-parameter-properties': 'off',
41+
'@typescript-eslint/no-this-alias': 'warn',
42+
'@typescript-eslint/no-use-before-define': 'off',
43+
'@typescript-eslint/no-var-requires': 'warn',
44+
'@typescript-eslint/prefer-for-of': 'warn',
45+
'@typescript-eslint/prefer-function-type': 'warn',
46+
'@typescript-eslint/prefer-namespace-keyword': 'warn',
47+
'@typescript-eslint/quotes': ['warn', 'single'],
48+
'@typescript-eslint/semi': ['off', null],
49+
'@typescript-eslint/triple-slash-reference': 'warn',
50+
'@typescript-eslint/type-annotation-spacing': 'off',
51+
'@typescript-eslint/unified-signatures': 'warn',
52+
'arrow-parens': ['off', 'as-needed'],
53+
camelcase: 'off',
54+
'comma-dangle': 'off',
55+
complexity: 'off',
56+
'constructor-super': 'warn',
57+
'dot-notation': 'warn',
58+
'eol-last': 'off',
59+
eqeqeq: ['warn', 'smart'],
60+
'guard-for-in': 'warn',
61+
'id-blacklist': 'off',
62+
'id-match': 'off',
63+
'import/no-internal-modules': 'off',
64+
'linebreak-style': 'off',
65+
'max-classes-per-file': ['warn', 1],
66+
'max-len': 'off',
67+
'new-parens': 'off',
68+
'newline-per-chained-call': 'off',
69+
'no-bitwise': 'warn',
70+
'no-caller': 'warn',
71+
'no-cond-assign': 'warn',
72+
'no-console': 'warn',
73+
'no-debugger': 'warn',
74+
'no-duplicate-case': 'warn',
75+
'no-duplicate-imports': 'warn',
76+
'no-empty': 'warn',
77+
'no-eval': 'warn',
78+
'no-extra-bind': 'warn',
79+
'no-extra-semi': 'off',
80+
'no-fallthrough': 'off',
81+
'no-invalid-this': 'off',
82+
'no-irregular-whitespace': 'off',
83+
'no-multiple-empty-lines': 'off',
84+
'no-new-func': 'warn',
85+
'no-new-wrappers': 'warn',
86+
'no-redeclare': 'warn',
87+
'no-return-await': 'warn',
88+
'no-sequences': 'warn',
89+
'no-shadow': [
90+
'warn',
91+
{
92+
hoist: 'all',
93+
},
94+
],
95+
'no-sparse-arrays': 'warn',
96+
'no-template-curly-in-string': 'warn',
97+
'no-throw-literal': 'warn',
98+
'no-trailing-spaces': 'off',
99+
'no-undef-init': 'warn',
100+
'no-underscore-dangle': 'off',
101+
'no-unsafe-finally': 'warn',
102+
'no-unused-expressions': 'warn',
103+
'no-unused-labels': 'warn',
104+
'no-var': 'warn',
105+
'object-shorthand': 'warn',
106+
'one-var': ['warn', 'never'],
107+
'prefer-const': 'warn',
108+
'prefer-object-spread': 'warn',
109+
'quote-props': 'off',
110+
radix: 'warn',
111+
'space-before-function-paren': 'off',
112+
'space-in-parens': ['off', 'never'],
113+
'spaced-comment': 'warn',
114+
'use-isnan': 'warn',
115+
'valid-typeof': 'off',
116+
},
117+
};

babel.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = api => {
33
api.cache(true);
44

55
return {
6-
presets: ['next/babel', '@zeit/next-typescript/babel'],
6+
presets: ['next/babel'],
77
plugins: [
88
// '@babel/plugin-syntax-dynamic-import',
99
// '@babel/plugin-proposal-export-default-from',

next-env.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/types/global" />

next.config.js

+52-57
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,55 @@
1-
const withTypescript = require('@zeit/next-typescript');
21
const withCSS = require('@zeit/next-css');
32

4-
module.exports = withTypescript(
5-
withCSS(
6-
{
7-
async exportPathMap() {
8-
return {
9-
'/': { page: '/' },
10-
'/news': { page: '/' },
11-
'/active': { page: '/active' },
12-
'/ask': { page: '/ask' },
13-
'/best': { page: '/best' },
14-
'/bestcomments': { page: '/bestcomments' },
15-
'/bookmarklet': { page: '/bookmarklet' },
16-
'/dmca': { page: '/dmca' },
17-
'/formatdoc': { page: '/formatdoc' },
18-
'/front': { page: '/front' },
19-
'/item': { page: '/item' },
20-
'/jobs': { page: '/jobs' },
21-
'/leaders': { page: '/leaders' },
22-
'/lists': { page: '/lists' },
23-
'/login': { page: '/login' },
24-
'/newcomments': { page: '/newcomments' },
25-
'/newest': { page: '/newest' },
26-
'/newpoll': { page: '/newpoll' },
27-
'/newsfaq': { page: '/newsfaq' },
28-
'/newsguidelines': { page: '/newsguidelines' },
29-
'/newswelcome': { page: '/newswelcome' },
30-
'/noobcomments': { page: '/noobcomments' },
31-
'/security': { page: '/security' },
32-
'/show': { page: '/show' },
33-
'/submit': { page: '/submit' },
34-
'/threads': { page: '/threads' },
35-
// '/p/975': { page: '/post', query: { id: '975' } },
36-
// '/p/481': { page: '/post', query: { id: '481' } },
37-
};
38-
},
39-
webpack: (config, { dev, defaultLoaders }) => {
40-
// Perform customizations to webpack config
41-
if (!dev) {
42-
config.module.rules.push({
43-
test: /\.(css|ico|gif)$/,
44-
use: [
45-
{
46-
loader: 'file-loader',
47-
options: {
48-
outputPath: 'static/',
49-
},
3+
module.exports = withCSS({
4+
async exportPathMap() {
5+
return {
6+
'/': { page: '/' },
7+
'/news': { page: '/' },
8+
'/active': { page: '/active' },
9+
'/ask': { page: '/ask' },
10+
'/best': { page: '/best' },
11+
'/bestcomments': { page: '/bestcomments' },
12+
'/bookmarklet': { page: '/bookmarklet' },
13+
'/dmca': { page: '/dmca' },
14+
'/formatdoc': { page: '/formatdoc' },
15+
'/front': { page: '/front' },
16+
'/item': { page: '/item' },
17+
'/jobs': { page: '/jobs' },
18+
'/leaders': { page: '/leaders' },
19+
'/lists': { page: '/lists' },
20+
'/login': { page: '/login' },
21+
'/newcomments': { page: '/newcomments' },
22+
'/newest': { page: '/newest' },
23+
'/newpoll': { page: '/newpoll' },
24+
'/newsfaq': { page: '/newsfaq' },
25+
'/newsguidelines': { page: '/newsguidelines' },
26+
'/newswelcome': { page: '/newswelcome' },
27+
'/noobcomments': { page: '/noobcomments' },
28+
'/security': { page: '/security' },
29+
'/show': { page: '/show' },
30+
'/submit': { page: '/submit' },
31+
'/threads': { page: '/threads' },
32+
// '/p/975': { page: '/post', query: { id: '975' } },
33+
// '/p/481': { page: '/post', query: { id: '481' } },
34+
};
35+
},
36+
webpack: (config, { dev, defaultLoaders }) => {
37+
// Perform customizations to webpack config
38+
if (!dev) {
39+
config.module.rules.push({
40+
test: /\.(css|ico|gif)$/,
41+
use: [
42+
{
43+
loader: 'file-loader',
44+
options: {
45+
outputPath: 'static/',
5046
},
51-
],
52-
});
53-
}
54-
config.node = { fs: 'empty' };
55-
return config;
56-
},
57-
cssModules: false,
58-
}
59-
)
60-
);
47+
},
48+
],
49+
});
50+
}
51+
config.node = { fs: 'empty' };
52+
return config;
53+
},
54+
cssModules: false,
55+
});

package-lock.json

-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,10 @@
7777
"@types/passport": "1.0.2",
7878
"@types/passport-local": "1.0.33",
7979
"@types/react": "16.9.23",
80-
"@types/zeit__next-typescript": "0.1.3",
8180
"@typescript-eslint/eslint-plugin": "2.22.0",
8281
"@typescript-eslint/eslint-plugin-tslint": "2.22.0",
8382
"@typescript-eslint/parser": "2.22.0",
8483
"@zeit/next-css": "1.0.1",
85-
"@zeit/next-typescript": "1.1.1",
8684
"babel-loader": "8.0.6",
8785
"babel-plugin-transform-define": "2.0.0",
8886
"enzyme": "3.11.0",

0 commit comments

Comments
 (0)