style: fix lint issues in code 🕺 (#626)

* style: fix lint issues in code 🕺

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* style: lint fix all files

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* chore: add `keywords` for better reach

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* feat: add `husky` & `commitlint`

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* chore: ignore `public` directory

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* revert: do not lint `public` directory

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* style: fix issues with lint

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* feat: add eslint config

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* feat: add lint-staged

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* style: lint fix all file(s)

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* fix: ignore rules for light version

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* fix: remove unnecessary space

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* chore(deps): update lockfile

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* style: autofix linting issue(s)

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
This commit is contained in:
Vinayak Kulkarni
2022-11-09 09:26:07 +05:30
committed by GitHub
parent 50201f0a99
commit 9b64093c42
24 changed files with 8084 additions and 1264 deletions

View File

@@ -1,38 +1,41 @@
const testIs = function(url, type, status) {
it(url + ' return ' + (status || 200) + ' and is ' + type.toString(),
function(done) {
supertest(app)
.get(url)
.expect(status || 200)
.expect('Content-Type', type, done);
});
const testIs = function (url, type, status) {
it(
url + ' return ' + (status || 200) + ' and is ' + type.toString(),
function (done) {
supertest(app)
.get(url)
.expect(status || 200)
.expect('Content-Type', type, done);
},
);
};
const prefix = 'test-style';
describe('Styles', function() {
describe('/styles/' + prefix + '/style.json is valid style', function() {
describe('Styles', function () {
describe('/styles/' + prefix + '/style.json is valid style', function () {
testIs('/styles/' + prefix + '/style.json', /application\/json/);
it('contains expected properties', function(done) {
it('contains expected properties', function (done) {
supertest(app)
.get('/styles/' + prefix + '/style.json')
.expect(function(res) {
expect(res.body.version).to.be.equal(8);
expect(res.body.name).to.be.a('string');
expect(res.body.sources).to.be.a('object');
expect(res.body.glyphs).to.be.a('string');
expect(res.body.sprite).to.be.a('string');
expect(res.body.sprite).to.be.equal('/test/styles/test-style/sprite');
expect(res.body.layers).to.be.a('array');
}).end(done);
.get('/styles/' + prefix + '/style.json')
.expect(function (res) {
expect(res.body.version).to.be.equal(8);
expect(res.body.name).to.be.a('string');
expect(res.body.sources).to.be.a('object');
expect(res.body.glyphs).to.be.a('string');
expect(res.body.sprite).to.be.a('string');
expect(res.body.sprite).to.be.equal('/test/styles/test-style/sprite');
expect(res.body.layers).to.be.a('array');
})
.end(done);
});
});
describe('/styles/streets/style.json is not served', function() {
describe('/styles/streets/style.json is not served', function () {
testIs('/styles/streets/style.json', /./, 404);
});
describe('/styles/' + prefix + '/sprite[@2x].{format}', function() {
describe('/styles/' + prefix + '/sprite[@2x].{format}', function () {
testIs('/styles/' + prefix + '/sprite.json', /application\/json/);
testIs('/styles/' + prefix + '/sprite@2x.json', /application\/json/);
testIs('/styles/' + prefix + '/sprite.png', /image\/png/);
@@ -40,11 +43,13 @@ describe('Styles', function() {
});
});
describe('Fonts', function() {
describe('Fonts', function () {
testIs('/fonts/Open Sans Bold/0-255.pbf', /application\/x-protobuf/);
testIs('/fonts/Open Sans Regular/65280-65535.pbf', /application\/x-protobuf/);
testIs('/fonts/Open Sans Bold,Open Sans Regular/0-255.pbf',
/application\/x-protobuf/);
testIs(
'/fonts/Open Sans Bold,Open Sans Regular/0-255.pbf',
/application\/x-protobuf/,
);
testIs('/fonts/Nonsense,Open Sans Bold/0-255.pbf', /./, 400);
testIs('/fonts/Nonsense/0-255.pbf', /./, 400);