Skip to content

Commit ee0168f

Browse files
author
artem-nanavov
committed
feat: init react, ts, webpack, etc
0 parents  commit ee0168f

25 files changed

+13635
-0
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
/.git
4+
/.vscode
5+
node_modules

.eslintrc.js

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2020: true,
5+
node: true,
6+
jest: true,
7+
},
8+
extends: [
9+
'plugin:react/recommended',
10+
'airbnb',
11+
'plugin:jest/recommended',
12+
'plugin:prettier/recommended',
13+
'plugin:@typescript-eslint/recommended',
14+
],
15+
settings: {
16+
'import/resolver': {
17+
node: {
18+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
19+
paths: ['./'],
20+
},
21+
},
22+
},
23+
parser: '@typescript-eslint/parser',
24+
parserOptions: {
25+
parserOptions: {
26+
ecmaVersion: 2020,
27+
},
28+
ecmaFeatures: {
29+
jsx: true,
30+
},
31+
ecmaVersion: 11,
32+
sourceType: 'module',
33+
},
34+
plugins: ['react', '@typescript-eslint', 'import', 'jsx-a11y', 'prettier'],
35+
rules: {
36+
'linebreak-style': 'off', // Неправильно работает в Windows.
37+
38+
'arrow-parens': 'off', // Несовместимо с prettier
39+
'object-curly-newline': 'off', // Несовместимо с prettier
40+
'no-mixed-operators': 'off', // Несовместимо с prettier
41+
// 'arrow-body-style': 'off', // Это - не наш стиль?
42+
'function-paren-newline': 'off', // Несовместимо с prettier
43+
'no-plusplus': 'off',
44+
'space-before-function-paren': 0, // Несовместимо с prettier
45+
46+
'max-len': ['error', 130, 2, { ignoreUrls: true }], // airbnb позволяет некоторые пограничные случаи
47+
'no-console': 'error', // airbnb использует предупреждение
48+
'no-alert': 'error', // airbnb использует предупреждение
49+
50+
'no-param-reassign': 'off', // Это - не наш стиль?
51+
radix: 'off', // parseInt, parseFloat и radix выключены. Мне это не нравится.
52+
53+
'react/require-default-props': 'off', // airbnb использует уведомление об ошибке
54+
'react/forbid-prop-types': 'off', // airbnb использует уведомление об ошибке
55+
56+
'prefer-destructuring': 'off',
57+
58+
'react/no-find-dom-node': 'off', // Я этого не знаю
59+
'react/no-did-mount-set-state': 'off',
60+
'react/no-unused-prop-types': 'off', // Это всё ещё работает нестабильно
61+
'react/jsx-one-expression-per-line': 'off',
62+
63+
'jsx-a11y/anchor-is-valid': ['error', { components: ['Link'], specialLink: ['to'] }],
64+
'jsx-a11y/label-has-for': [
65+
2,
66+
{
67+
required: {
68+
every: ['id'],
69+
},
70+
},
71+
], // для ошибки вложенных свойств htmlFor элементов label
72+
73+
'prettier/prettier': ['error'],
74+
75+
'import/order': [
76+
'error',
77+
{
78+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
79+
warnOnUnassignedImports: true,
80+
'newlines-between': 'always-and-inside-groups',
81+
pathGroups: [
82+
{
83+
pattern: '**/*.scss',
84+
group: 'index',
85+
position: 'after',
86+
},
87+
{
88+
pattern: './assets/**',
89+
group: 'sibling',
90+
position: 'before',
91+
},
92+
],
93+
},
94+
],
95+
96+
'import/no-extraneous-dependencies': 'off',
97+
'jsx-a11y/click-events-have-key-events': 'off',
98+
'react/jsx-key': 'error',
99+
'@typescript-eslint/no-var-requires': 'off',
100+
'react/jsx-no-target-blank': 'error',
101+
'jsx-a11y/no-static-element-interactions': 'off',
102+
'react/prop-types': 'off',
103+
camelcase: 'off',
104+
indent: [2, 'tab'],
105+
'react/jsx-indent': [2, 'tab'],
106+
'react/jsx-indent-props': [2, 'tab'],
107+
'no-tabs': 'off',
108+
'import/no-unresolved': 'warn',
109+
'object-curly-spacing': 'off',
110+
'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
111+
'import/extensions': 'off',
112+
'no-unused-vars': 'off',
113+
'@typescript-eslint/no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: false }],
114+
'react/jsx-props-no-spreading': 'off',
115+
'no-autofocus': 'off',
116+
'no-underscore-dangle': 'off',
117+
'jsx-a11y/label-has-associated-control': [2, { assert: 'either', depth: 25 }],
118+
},
119+
};

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
npm-debug.log
2+
node_modules/
3+
dist/
4+
tmp/

.vscode/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"typescript.tsdk": "./node_modules/typescript/lib",
3+
"files.eol": "\n",
4+
"json.schemas": [
5+
{
6+
"fileMatch": [
7+
"/manifest.json"
8+
],
9+
"url": "http://json.schemastore.org/chrome-manifest"
10+
}
11+
],
12+
"editor.formatOnSave": true,
13+
"editor.codeActionsOnSave": {
14+
"source.fixAll.eslint": true
15+
},
16+
}

.vscode/tasks.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"command": "npm",
6+
"tasks": [
7+
{
8+
"label": "install",
9+
"type": "shell",
10+
"command": "npm",
11+
"args": ["install"]
12+
},
13+
{
14+
"label": "update",
15+
"type": "shell",
16+
"command": "npm",
17+
"args": ["update"]
18+
},
19+
{
20+
"label": "test",
21+
"type": "shell",
22+
"command": "npm",
23+
"args": ["run", "test"]
24+
},
25+
{
26+
"label": "build",
27+
"type": "shell",
28+
"group": "build",
29+
"command": "npm",
30+
"args": ["run", "watch"]
31+
}
32+
]
33+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Tomofumi Chiba
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Whitespace-only changes.

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
roots: ['src'],
3+
transform: {
4+
'^.+\\.ts$': 'ts-jest',
5+
},
6+
};

modules/background/background.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function polling() {
2+
// console.log("polling");
3+
setTimeout(polling, 1000 * 30);
4+
}
5+
6+
polling();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
2+
if (msg.color) {
3+
// eslint-disable-next-line no-console
4+
console.log(`Receive color = ${msg.color}`);
5+
document.body.style.backgroundColor = msg.color;
6+
sendResponse(`Change color to ${msg.color}`);
7+
} else {
8+
sendResponse('Color message is none.');
9+
}
10+
});

0 commit comments

Comments
 (0)