0
0
mirror of https://github.com/lipis/flag-icons.git synced 2024-11-21 18:38:57 +01:00

Simplify prettier (#1006)

This commit is contained in:
Lipis 2022-06-21 11:00:43 +03:00 committed by GitHub
parent 82d2cf8b5c
commit 41464d0c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 55 additions and 74 deletions

View File

@ -1,8 +1,8 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: npm - package-ecosystem: npm
directory: '/' directory: "/"
schedule: schedule:
interval: daily interval: daily
time: '02:00' time: "02:00"
open-pull-requests-limit: 10 open-pull-requests-limit: 10

View File

@ -10,7 +10,7 @@ jobs:
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4.0.0 uses: actions/setup-python@v4.0.0
with: with:
python-version: '3.x' python-version: "3.x"
architecture: 'x64' architecture: "x64"
- name: Test flags - name: Test flags
run: python flags.py run: python flags.py

View File

@ -1,4 +1,4 @@
name: Tests name: Test Format
on: pull_request on: pull_request
@ -10,7 +10,7 @@ jobs:
- name: Setup Node.js LTS - name: Setup Node.js LTS
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 'lts/*' node-version: "lts/*"
- name: Install and test - name: Install and test
run: | run: |
yarn --frozen-lockfile yarn --frozen-lockfile

View File

@ -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
}
}
]
}

View File

@ -1,9 +1,9 @@
const loadJSON = (path, callback) => { const loadJSON = (path, callback) => {
var xobj = new XMLHttpRequest(); var xobj = new XMLHttpRequest();
xobj.overrideMimeType('application/json'); xobj.overrideMimeType("application/json");
xobj.open('GET', path, true); xobj.open("GET", path, true);
xobj.onreadystatechange = function () { xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == '200') { if (xobj.readyState == 4 && xobj.status == "200") {
callback(xobj.responseText); callback(xobj.responseText);
} }
}; };
@ -11,37 +11,37 @@ const loadJSON = (path, callback) => {
}; };
const addFlag = (country, rowDiv) => { const addFlag = (country, rowDiv) => {
const colDiv = document.createElement('div'); const colDiv = document.createElement("div");
colDiv.classList.add('col-xl-2'); colDiv.classList.add("col-xl-2");
colDiv.classList.add('col-lg-3'); colDiv.classList.add("col-lg-3");
colDiv.classList.add('col-md-4'); colDiv.classList.add("col-md-4");
colDiv.classList.add('col-6'); colDiv.classList.add("col-6");
colDiv.id = country.code; colDiv.id = country.code;
const flagDiv = document.createElement('div'); const flagDiv = document.createElement("div");
flagDiv.classList.add('flag'); flagDiv.classList.add("flag");
// Code // Code
const codeSpan = document.createElement('span'); const codeSpan = document.createElement("span");
codeSpan.classList.add('flag-code'); codeSpan.classList.add("flag-code");
const code = document.createTextNode(country.code); const code = document.createTextNode(country.code);
codeSpan.appendChild(code); codeSpan.appendChild(code);
// Divider // Divider
const dividerSpan = document.createElement('span'); const dividerSpan = document.createElement("span");
const divider = document.createTextNode(' '); const divider = document.createTextNode(" ");
dividerSpan.appendChild(divider); dividerSpan.appendChild(divider);
//Country //Country
const countryDiv = document.createElement('div'); const countryDiv = document.createElement("div");
countryDiv.classList.add('flag-country'); countryDiv.classList.add("flag-country");
countryDiv.classList.add('no-wrap'); countryDiv.classList.add("no-wrap");
countryDiv.title = country.name; countryDiv.title = country.name;
const countrySpan = document.createElement('span'); const countrySpan = document.createElement("span");
const countryName = document.createTextNode(country.name); const countryName = document.createTextNode(country.name);
countrySpan.appendChild(countryName); countrySpan.appendChild(countryName);
countryDiv.appendChild(codeSpan); countryDiv.appendChild(codeSpan);
countryDiv.appendChild(dividerSpan); countryDiv.appendChild(dividerSpan);
countryDiv.appendChild(countrySpan); countryDiv.appendChild(countrySpan);
const flagImg = document.createElement('img'); const flagImg = document.createElement("img");
flagImg.classList.add('flag-img'); flagImg.classList.add("flag-img");
flagImg.src = country.flag_4x3; flagImg.src = country.flag_4x3;
flagImg.alt = `Flag of ${country.name}`; flagImg.alt = `Flag of ${country.name}`;
@ -52,9 +52,9 @@ const addFlag = (country, rowDiv) => {
}; };
window.onload = function () { window.onload = function () {
const isoFlagsRow = document.getElementById('iso-flags'); const isoFlagsRow = document.getElementById("iso-flags");
const nonIsoFlagsRow = document.getElementById('non-iso-flags'); const nonIsoFlagsRow = document.getElementById("non-iso-flags");
loadJSON('country.json', response => { loadJSON("country.json", (response) => {
const countries = JSON.parse(response); const countries = JSON.parse(response);
for (country of countries) { for (country of countries) {
console.log(country); console.log(country);

View File

@ -32,8 +32,8 @@
function gtag() { function gtag() {
dataLayer.push(arguments); dataLayer.push(arguments);
} }
gtag('js', new Date()); gtag("js", new Date());
gtag('config', 'G-4P6P2EW03Y'); gtag("config", "G-4P6P2EW03Y");
</script> </script>
</head> </head>
<body> <body>

View File

@ -11,7 +11,7 @@
width: unit((4 / 3), em); width: unit((4 / 3), em);
line-height: 1em; line-height: 1em;
&:before { &:before {
content: '\00a0'; content: "\00a0";
} }
&.fis { &.fis {
width: 1em; width: 1em;
@ -20,9 +20,9 @@
.flag-icon(@country) { .flag-icon(@country) {
.fi-@{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 { &.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)";
} }
} }
} }

View File

@ -1,4 +1,4 @@
@import 'variables'; @import "variables";
@import 'flag-icons-base'; @import "flag-icons-base";
@import 'flag-icons-list'; @import "flag-icons-list";
@import 'flag-icons-more'; @import "flag-icons-more";

View File

@ -1,3 +1,3 @@
@flag-icons-path: '../flags'; @flag-icons-path: "../flags";
@flag-icons-rect-path: '/4x3'; @flag-icons-rect-path: "/4x3";
@flag-icons-square-path: '/1x1'; @flag-icons-square-path: "/1x1";

View File

@ -11,7 +11,7 @@
width: 1.333333 * 1em; width: 1.333333 * 1em;
line-height: 1em; line-height: 1em;
&:before { &:before {
content: '\00a0'; content: "\00a0";
} }
&.fis { &.fis {
width: 1em; width: 1em;

View File

@ -1,4 +1,4 @@
$flag-icons-path: '../flags' !default; $flag-icons-path: "../flags" !default;
$flag-icons-rect-path: '/4x3' !default; $flag-icons-rect-path: "/4x3" !default;
$flag-icons-square-path: '/1x1' !default; $flag-icons-square-path: "/1x1" !default;
$flag-icons-use-square: true !default; $flag-icons-use-square: true !default;

View File

@ -1,3 +1,3 @@
@import 'variables'; @import "variables";
@import 'flag-icons-base'; @import "flag-icons-base";
@import 'flag-icons-list'; @import "flag-icons-list";

View File

@ -1,17 +1,17 @@
module.exports = { module.exports = {
plugins: [ plugins: [
{ {
name: 'preset-default', name: "preset-default",
params: { params: {
overrides: { overrides: {
cleanupIDs: false, cleanupIDs: false,
}, },
}, },
}, },
'convertStyleToAttrs', "convertStyleToAttrs",
'removeDimensions', "removeDimensions",
'removeScriptElement', "removeScriptElement",
'removeStyleElement', "removeStyleElement",
'sortAttrs', "sortAttrs",
], ],
}; };