0
0
mirror of https://github.com/lipis/flag-icons.git synced 2024-11-21 10:28:56 +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
updates:
- package-ecosystem: npm
directory: '/'
directory: "/"
schedule:
interval: daily
time: '02:00'
time: "02:00"
open-pull-requests-limit: 10

View File

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

View File

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

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) => {
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);

View File

@ -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");
</script>
</head>
<body>

View File

@ -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)";
}
}
}

View File

@ -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";

View File

@ -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";

View File

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

View File

@ -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;

View File

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

View File

@ -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",
],
};