diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..2783902 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,24 @@ +name: Node.js CI (format) + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + format: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [21.x] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run format:check diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..974b6c7 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,5 @@ +{ + "printWidth": 120, + "tabWidth": 4, + "trailingComma": "none" +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1e56353..9f7e37b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "chokidar": "^3.6.0", "copy-webpack-plugin": "^12.0.2", + "prettier": "^3.2.5", "ts-loader": "^9.5.1", "ts-node": "^10.9.2", "twi-ext": "^0.4.1", @@ -4709,6 +4710,20 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -10071,6 +10086,11 @@ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" }, + "prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==" + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", diff --git a/package.json b/package.json index 212c475..b42f420 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "scripts": { "build": "webpack", "watch": "webpack --watch", + "format": "npx prettier --write ./src/**/*", + "format:check": "npx prettier --check ./src/**/*", "package": "ts-node ./script/package.ts", "version": "npm run build && git add ." }, @@ -27,6 +29,7 @@ "dependencies": { "chokidar": "^3.6.0", "copy-webpack-plugin": "^12.0.2", + "prettier": "^3.2.5", "ts-loader": "^9.5.1", "ts-node": "^10.9.2", "twi-ext": "^0.4.1", @@ -35,4 +38,4 @@ "webpack": "^5.91.0", "webpack-cli": "^5.1.4" } -} +} \ No newline at end of file diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index a525962..e1520fa 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -2,4 +2,4 @@ "manifest_description": { "message": "This extension hides the number of impressions on Twitter and prevents the creation of an approval desire monster." } -} \ No newline at end of file +} diff --git a/src/_locales/ja/messages.json b/src/_locales/ja/messages.json index be80edb..85da80e 100644 --- a/src/_locales/ja/messages.json +++ b/src/_locales/ja/messages.json @@ -2,4 +2,4 @@ "manifest_description": { "message": "Twitterのインプレッション数を非表示にして、承認欲求モンスターが生まれてしまうのを防ぐ拡張機能です。" } -} \ No newline at end of file +} diff --git a/src/manifest/v2.json b/src/manifest/v2.json index ea636f2..d758c30 100644 --- a/src/manifest/v2.json +++ b/src/manifest/v2.json @@ -11,18 +11,12 @@ }, "content_scripts": [ { - "matches": [ - "https://twitter.com/*", - "https://mobile.twitter.com/*", - "https://pro.twitter.com/*" - ], - "js": [ - "js/index.js" - ] + "matches": ["https://twitter.com/*", "https://mobile.twitter.com/*", "https://pro.twitter.com/*"], + "js": ["js/index.js"] } ], "default_locale": "en", "browser_specific_settings": { "gecko_android": {} } -} \ No newline at end of file +} diff --git a/src/manifest/v3.json b/src/manifest/v3.json index ebc6104..e0cc825 100644 --- a/src/manifest/v3.json +++ b/src/manifest/v3.json @@ -11,18 +11,12 @@ }, "content_scripts": [ { - "matches": [ - "https://twitter.com/*", - "https://mobile.twitter.com/*", - "https://pro.twitter.com/*" - ], - "js": [ - "js/index.js" - ] + "matches": ["https://twitter.com/*", "https://mobile.twitter.com/*", "https://pro.twitter.com/*"], + "js": ["js/index.js"] } ], "default_locale": "en", "browser_specific_settings": { "gecko_android": {} } -} \ No newline at end of file +}