From 41464d0c238b2ccb81a4a917bcf84b1c7f94d39a Mon Sep 17 00:00:00 2001 From: Lipis Date: Tue, 21 Jun 2022 11:00:43 +0300 Subject: [PATCH] Simplify prettier (#1006) --- .github/dependabot.yml | 4 +- .github/workflows/flags.yml | 4 +- .github/workflows/{test.yml => format.yml} | 4 +- .prettierrc.json | 21 +--------- assets/docs.js | 46 +++++++++++----------- index.html | 4 +- less/flag-icons-base.less | 6 +-- less/flag-icons.less | 8 ++-- less/variables.less | 6 +-- sass/_flag-icons-base.scss | 2 +- sass/_variables.scss | 6 +-- sass/flag-icons.scss | 6 +-- svgo.config.js | 12 +++--- 13 files changed, 55 insertions(+), 74 deletions(-) rename .github/workflows/{test.yml => format.yml} (85%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ec79cca3..4190e539 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,8 +1,8 @@ version: 2 updates: - package-ecosystem: npm - directory: '/' + directory: "/" schedule: interval: daily - time: '02:00' + time: "02:00" open-pull-requests-limit: 10 diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index 34a51046..0ca2800b 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -10,7 +10,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4.0.0 with: - python-version: '3.x' - architecture: 'x64' + python-version: "3.x" + architecture: "x64" - name: Test flags run: python flags.py diff --git a/.github/workflows/test.yml b/.github/workflows/format.yml similarity index 85% rename from .github/workflows/test.yml rename to .github/workflows/format.yml index ad52459d..80a162ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/format.yml @@ -1,4 +1,4 @@ -name: Tests +name: Test Format on: pull_request @@ -10,7 +10,7 @@ jobs: - name: Setup Node.js LTS uses: actions/setup-node@v3 with: - node-version: 'lts/*' + node-version: "lts/*" - name: Install and test run: | yarn --frozen-lockfile diff --git a/.prettierrc.json b/.prettierrc.json index 309dd17d..0967ef42 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,20 +1 @@ -{ - "arrowParens": "avoid", - "bracketSpacing": false, - "printWidth": 80, - "proseWrap": "never", - "requirePragma": false, - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "all", - "useTabs": false, - "overrides": [ - { - "files": "*.json", - "options": { - "printWidth": 200 - } - } - ] -} +{} diff --git a/assets/docs.js b/assets/docs.js index 6160a519..4ddda936 100644 --- a/assets/docs.js +++ b/assets/docs.js @@ -1,9 +1,9 @@ const loadJSON = (path, callback) => { var xobj = new XMLHttpRequest(); - xobj.overrideMimeType('application/json'); - xobj.open('GET', path, true); + xobj.overrideMimeType("application/json"); + xobj.open("GET", path, true); xobj.onreadystatechange = function () { - if (xobj.readyState == 4 && xobj.status == '200') { + if (xobj.readyState == 4 && xobj.status == "200") { callback(xobj.responseText); } }; @@ -11,37 +11,37 @@ const loadJSON = (path, callback) => { }; const addFlag = (country, rowDiv) => { - const colDiv = document.createElement('div'); - colDiv.classList.add('col-xl-2'); - colDiv.classList.add('col-lg-3'); - colDiv.classList.add('col-md-4'); - colDiv.classList.add('col-6'); + const colDiv = document.createElement("div"); + colDiv.classList.add("col-xl-2"); + colDiv.classList.add("col-lg-3"); + colDiv.classList.add("col-md-4"); + colDiv.classList.add("col-6"); colDiv.id = country.code; - const flagDiv = document.createElement('div'); - flagDiv.classList.add('flag'); + const flagDiv = document.createElement("div"); + flagDiv.classList.add("flag"); // Code - const codeSpan = document.createElement('span'); - codeSpan.classList.add('flag-code'); + const codeSpan = document.createElement("span"); + codeSpan.classList.add("flag-code"); const code = document.createTextNode(country.code); codeSpan.appendChild(code); // Divider - const dividerSpan = document.createElement('span'); - const divider = document.createTextNode(' '); + const dividerSpan = document.createElement("span"); + const divider = document.createTextNode(" "); dividerSpan.appendChild(divider); //Country - const countryDiv = document.createElement('div'); - countryDiv.classList.add('flag-country'); - countryDiv.classList.add('no-wrap'); + const countryDiv = document.createElement("div"); + countryDiv.classList.add("flag-country"); + countryDiv.classList.add("no-wrap"); countryDiv.title = country.name; - const countrySpan = document.createElement('span'); + const countrySpan = document.createElement("span"); const countryName = document.createTextNode(country.name); countrySpan.appendChild(countryName); countryDiv.appendChild(codeSpan); countryDiv.appendChild(dividerSpan); countryDiv.appendChild(countrySpan); - const flagImg = document.createElement('img'); - flagImg.classList.add('flag-img'); + const flagImg = document.createElement("img"); + flagImg.classList.add("flag-img"); flagImg.src = country.flag_4x3; flagImg.alt = `Flag of ${country.name}`; @@ -52,9 +52,9 @@ const addFlag = (country, rowDiv) => { }; window.onload = function () { - const isoFlagsRow = document.getElementById('iso-flags'); - const nonIsoFlagsRow = document.getElementById('non-iso-flags'); - loadJSON('country.json', response => { + const isoFlagsRow = document.getElementById("iso-flags"); + const nonIsoFlagsRow = document.getElementById("non-iso-flags"); + loadJSON("country.json", (response) => { const countries = JSON.parse(response); for (country of countries) { console.log(country); diff --git a/index.html b/index.html index 9552a22b..ae1d90d1 100644 --- a/index.html +++ b/index.html @@ -32,8 +32,8 @@ function gtag() { dataLayer.push(arguments); } - gtag('js', new Date()); - gtag('config', 'G-4P6P2EW03Y'); + gtag("js", new Date()); + gtag("config", "G-4P6P2EW03Y"); diff --git a/less/flag-icons-base.less b/less/flag-icons-base.less index c2233b62..ead84355 100644 --- a/less/flag-icons-base.less +++ b/less/flag-icons-base.less @@ -11,7 +11,7 @@ width: unit((4 / 3), em); line-height: 1em; &:before { - content: '\00a0'; + content: "\00a0"; } &.fis { width: 1em; @@ -20,9 +20,9 @@ .flag-icon(@country) { .fi-@{country} { - background-image: ~'url(@{flag-icons-path}@{flag-icons-rect-path}/@{country}.svg)'; + background-image: ~"url(@{flag-icons-path}@{flag-icons-rect-path}/@{country}.svg)"; &.fis { - background-image: ~'url(@{flag-icons-path}@{flag-icons-square-path}/@{country}.svg)'; + background-image: ~"url(@{flag-icons-path}@{flag-icons-square-path}/@{country}.svg)"; } } } diff --git a/less/flag-icons.less b/less/flag-icons.less index e19c1740..365a9b71 100644 --- a/less/flag-icons.less +++ b/less/flag-icons.less @@ -1,4 +1,4 @@ -@import 'variables'; -@import 'flag-icons-base'; -@import 'flag-icons-list'; -@import 'flag-icons-more'; +@import "variables"; +@import "flag-icons-base"; +@import "flag-icons-list"; +@import "flag-icons-more"; diff --git a/less/variables.less b/less/variables.less index 4909aaf0..be1e4d7b 100644 --- a/less/variables.less +++ b/less/variables.less @@ -1,3 +1,3 @@ -@flag-icons-path: '../flags'; -@flag-icons-rect-path: '/4x3'; -@flag-icons-square-path: '/1x1'; +@flag-icons-path: "../flags"; +@flag-icons-rect-path: "/4x3"; +@flag-icons-square-path: "/1x1"; diff --git a/sass/_flag-icons-base.scss b/sass/_flag-icons-base.scss index 1abf5947..9ac6087b 100644 --- a/sass/_flag-icons-base.scss +++ b/sass/_flag-icons-base.scss @@ -11,7 +11,7 @@ width: 1.333333 * 1em; line-height: 1em; &:before { - content: '\00a0'; + content: "\00a0"; } &.fis { width: 1em; diff --git a/sass/_variables.scss b/sass/_variables.scss index 6594b819..45977781 100644 --- a/sass/_variables.scss +++ b/sass/_variables.scss @@ -1,4 +1,4 @@ -$flag-icons-path: '../flags' !default; -$flag-icons-rect-path: '/4x3' !default; -$flag-icons-square-path: '/1x1' !default; +$flag-icons-path: "../flags" !default; +$flag-icons-rect-path: "/4x3" !default; +$flag-icons-square-path: "/1x1" !default; $flag-icons-use-square: true !default; diff --git a/sass/flag-icons.scss b/sass/flag-icons.scss index 6de775c4..fae29283 100644 --- a/sass/flag-icons.scss +++ b/sass/flag-icons.scss @@ -1,3 +1,3 @@ -@import 'variables'; -@import 'flag-icons-base'; -@import 'flag-icons-list'; +@import "variables"; +@import "flag-icons-base"; +@import "flag-icons-list"; diff --git a/svgo.config.js b/svgo.config.js index a2a9a044..fc5360a6 100644 --- a/svgo.config.js +++ b/svgo.config.js @@ -1,17 +1,17 @@ module.exports = { plugins: [ { - name: 'preset-default', + name: "preset-default", params: { overrides: { cleanupIDs: false, }, }, }, - 'convertStyleToAttrs', - 'removeDimensions', - 'removeScriptElement', - 'removeStyleElement', - 'sortAttrs', + "convertStyleToAttrs", + "removeDimensions", + "removeScriptElement", + "removeStyleElement", + "sortAttrs", ], };