diff --git a/.eslintrc.js b/.eslintrc.js index 7039b8c..d13dea3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,29 +4,35 @@ module.exports = { es2021: true, webextensions: true, }, - // settings: { - // 'import/resolver': { - // typescript: {}, - // }, - // }, - extends: ['plugin:react/recommended', 'airbnb'], - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaFeatures: { - jsx: true, + extends: [ + 'plugin:react/recommended', + 'airbnb', + ], + plugins: ['react'], + settings: { + 'import/resolver': { + node: { + extensions: ['.js', '.jsx'], + moduleDirectory: ['node_modules', 'src/'], + }, }, - ecmaVersion: 12, - sourceType: 'module', }, - plugins: ['react', '@typescript-eslint'], rules: { 'no-plusplus': 'off', 'comma-dangle': 'off', 'operator-linebreak': 'off', 'no-use-before-define': 'off', 'linebreak-style': 'off', - 'react/jsx-filename-extension': [1, { extensions: ['.tsx', '.ts'] }], + 'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.js'] }], 'jsx-a11y/label-has-associated-control': 'off', - 'prefer-destructuring': 'off' + 'prefer-destructuring': 'off', + 'import/extensions': [ + 'error', + 'ignorePackages', + { + js: 'never', + jsx: 'never', + }, + ], }, }; diff --git a/README.md b/README.md index ff030f5..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,29 +0,0 @@ -# Chrome Extension boilerplate created with React Typescript - -## Getting started - -Create a project based on this boilerplate. - -``` -$ npx degit https://github.com/sivertschou/react-typescript-chrome-extension-boilerplate.git -``` - -Navigate to the project directory and install the dependencies. - -``` -$ npm install -``` - -To build the extension, and rebuild it when the files are changed, run - -``` -$ npm start -``` - -After the project has been built, a directory named `dist` has been created. You have to add this directory to your Chrome browser: - -1. Open Chrome. -2. Navigate to `chrome://extensions`. -3. Enable _Developer mode_. -4. Click _Load unpacked_. -5. Select the `dist` directory. diff --git a/package-lock.json b/package-lock.json index 717f907..068074e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "reddit-toolkit", + "name": "vytal", "version": "1.0.0", "lockfileVersion": 2, "requires": true, diff --git a/package.json b/package.json index 0a6f87b..cfc1488 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "reddit-toolkit", + "name": "vytal", "version": "1.0.0", "description": "", "scripts": { diff --git a/public/manifest.json b/public/manifest.json index 509b1a1..cce74de 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,9 +1,9 @@ { - "name": "Reddit Toolkit", - "description": "Reddit Toolkit", + "name": "Vytal", + "description": "Vytal", "manifest_version": 3, "version": "1.0.0", - "permissions": ["storage", "declarativeNetRequest"], + "permissions": [], "icons": { "16": "icon_16.png", "32": "icon_32.png", @@ -21,21 +21,5 @@ }, "background": { "service_worker": "background.js" - }, - "declarative_net_request": { - "rule_resources": [ - { - "id": "ruleset_1", - "enabled": false, - "path": "rules.json" - } - ] - }, - "host_permissions": [ - "*://reddit.com/*", - "*://www.reddit.com/*", - "*://np.reddit.com/*", - "*://amp.reddit.com/*", - "*://i.reddit.com/*" - ] + } } diff --git a/public/rules.json b/public/rules.json deleted file mode 100644 index 8c1932b..0000000 --- a/public/rules.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "id": 1, - "priority": 1, - "action": { - "type": "redirect", - "redirect": { - "transform": { "scheme": "https", "host": "old.reddit.com" } - } - }, - "condition": { - "urlFilter": "||reddit.com", - "resourceTypes": ["main_frame"] - } - } -] \ No newline at end of file diff --git a/src/App.css b/src/App.css index b7ba439..c0b61a9 100644 --- a/src/App.css +++ b/src/App.css @@ -1,6 +1,5 @@ -.optionWrap { - display: flex; - align-items: center; +.title { + font-weight: 600; } input { diff --git a/src/App.jsx b/src/App.jsx new file mode 100644 index 0000000..f75eaa7 --- /dev/null +++ b/src/App.jsx @@ -0,0 +1,20 @@ +import * as React from 'react'; +import { useEffect } from 'react'; +import './App.css'; + +const App = () => { + useEffect(() => { + document.getElementById( + 'screenSize' + ).innerHTML += `Screen resolution: ${window.screen.width}x${window.screen.height}`; + }, []); + + return ( +
+
Hardware
+
+
+ ); +}; + +export default App; diff --git a/src/App.tsx b/src/App.tsx deleted file mode 100644 index 2e2e8f5..0000000 --- a/src/App.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import * as React from 'react'; -import { useState, useEffect } from 'react'; -import './App.css'; - -const handleChange = (el: React.ChangeEvent) => { - chrome.storage.sync.set({ [el.target.id]: el.target.checked }); - console.log(el.target.id); -}; - -// function getChecked(elID: string): boolean { -// // console.log(elID); -// chrome.storage.sync.get('oldRedirect', (res) => { -// console.log(res.oldRedirect + '123'); -// }); -// console.log('?'); -// return true; -// } - -const App = () => { - useEffect(() => { - chrome.storage.sync.get(null, (res) => { - const allKeys = Object.entries(res); - console.log(allKeys); - allKeys.forEach((item) => { - console.log(item); - const test: any = document.getElementById(item[0]); - test.checked = item[1]; - }); - }); - }, []); - - return ( -
- -
- ); -}; - -export default App; diff --git a/src/background.js b/src/background.js new file mode 100644 index 0000000..e69de29 diff --git a/src/background.ts b/src/background.ts deleted file mode 100644 index e6d06c9..0000000 --- a/src/background.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Initialize storage values -chrome.storage.sync.set({ oldRedirect: false }); - -chrome.storage.onChanged.addListener((changes) => { - if ('oldRedirect' in changes) { - if (changes.oldRedirect.newValue) { - (chrome as any).declarativeNetRequest.updateEnabledRulesets({ - enableRulesetIds: ['ruleset_1'], - }); - } else { - (chrome as any).declarativeNetRequest.updateEnabledRulesets({ - disableRulesetIds: ['ruleset_1'], - }); - } - } -}); diff --git a/src/content.ts b/src/content.js similarity index 100% rename from src/content.ts rename to src/content.js diff --git a/src/custom.d.ts b/src/custom.d.ts deleted file mode 100644 index c1c6de0..0000000 --- a/src/custom.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.svg" { - const content: any; - export default content; - } \ No newline at end of file diff --git a/src/popup.tsx b/src/popup.jsx similarity index 100% rename from src/popup.tsx rename to src/popup.jsx diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 51bbd1f..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./dist/", - "sourceMap": true, - "strict": true, - "noImplicitReturns": true, - "noImplicitAny": true, - "module": "es6", - "moduleResolution": "node", - "target": "es5", - "allowJs": true, - "jsx": "react", - }, - "include": [ - "./src/**/*", - "src/custom.d.ts" - ] -} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 5b13aa4..61770a6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,9 +4,9 @@ const CopyPlugin = require("copy-webpack-plugin"); const config = { entry: { - popup: path.join(__dirname, "src/popup.tsx"), - content: path.join(__dirname, "src/content.ts"), - background: path.join(__dirname, "src/background.ts"), + popup: path.join(__dirname, "src/popup.jsx"), + content: path.join(__dirname, "src/content.js"), + background: path.join(__dirname, "src/background.js"), }, output: { path: path.join(__dirname, "dist"), filename: "[name].js" }, module: {