mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
chore: Add eslint rules and fix strings to pass rules
This commit is contained in:
parent
8cd19254c5
commit
5f83fbc43d
11
.eslintrc
11
.eslintrc
@ -9,12 +9,16 @@
|
|||||||
],
|
],
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2019
|
"ecmaVersion": 2019,
|
||||||
|
"project": "./tsconfig.json"
|
||||||
},
|
},
|
||||||
"plugins": ["prettier","@typescript-eslint"],
|
"plugins": ["prettier","@typescript-eslint"],
|
||||||
"root": true,
|
"root": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-var-requires": 0,
|
"@typescript-eslint/no-var-requires": 0,
|
||||||
|
"@typescript-eslint/indent": 0,
|
||||||
|
"@typescript-eslint/naming-convention": 0,
|
||||||
|
"@typescript-eslint/space-before-function-paren": 0,
|
||||||
"import/no-unresolved": 0,
|
"import/no-unresolved": 0,
|
||||||
"class-methods-use-this": [0],
|
"class-methods-use-this": [0],
|
||||||
"prettier/prettier": ["error"],
|
"prettier/prettier": ["error"],
|
||||||
@ -40,7 +44,10 @@
|
|||||||
// enable the rule specifically for TypeScript files
|
// enable the rule specifically for TypeScript files
|
||||||
"files": ["*.ts", "*.tsx"],
|
"files": ["*.ts", "*.tsx"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/explicit-module-boundary-types": ["error"]
|
"@typescript-eslint/explicit-module-boundary-types": ["error"],
|
||||||
|
"@typescript-eslint/indent": ["error"],
|
||||||
|
"@typescript-eslint/naming-convention": ["error"],
|
||||||
|
"@typescript-eslint/space-before-function-paren": ["error"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -86,7 +86,7 @@ class JiraAddon extends Addon {
|
|||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: `To see what happened visit Unleash`,
|
text: 'To see what happened visit Unleash',
|
||||||
marks: [
|
marks: [
|
||||||
{
|
{
|
||||||
type: 'link',
|
type: 'link',
|
||||||
|
@ -113,7 +113,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (!options.db.host) {
|
if (!options.db.host) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unleash requires database details to start. See https://unleash.github.io/docs/getting_started`,
|
'Unleash requires database details to start. See https://unleash.github.io/docs/getting_started',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ test('should return applications', t => {
|
|||||||
stores.clientApplicationsStore.upsert({ appName });
|
stores.clientApplicationsStore.upsert({ appName });
|
||||||
|
|
||||||
return request
|
return request
|
||||||
.get(`/api/admin/metrics/applications/`)
|
.get('/api/admin/metrics/applications/')
|
||||||
.expect(200)
|
.expect(200)
|
||||||
.expect(res => {
|
.expect(res => {
|
||||||
const metrics = res.body;
|
const metrics = res.body;
|
||||||
|
@ -252,7 +252,7 @@ test('reactivating a non-existent strategy yields 404', t => {
|
|||||||
.set('Content-Type', 'application/json')
|
.set('Content-Type', 'application/json')
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
test(`deprecating 'default' strategy will yield 403`, t => {
|
test("deprecating 'default' strategy will yield 403", t => {
|
||||||
t.plan(0);
|
t.plan(0);
|
||||||
const { request, base, perms } = getSetup();
|
const { request, base, perms } = getSetup();
|
||||||
perms.withPermissions(UPDATE_STRATEGY);
|
perms.withPermissions(UPDATE_STRATEGY);
|
||||||
|
@ -63,7 +63,7 @@ class StateService {
|
|||||||
: await this.toggleStore.getFeatures();
|
: await this.toggleStore.getFeatures();
|
||||||
|
|
||||||
if (dropBeforeImport) {
|
if (dropBeforeImport) {
|
||||||
this.logger.info(`Dropping existing feature toggles`);
|
this.logger.info('Dropping existing feature toggles');
|
||||||
await this.toggleStore.dropFeatures();
|
await this.toggleStore.dropFeatures();
|
||||||
await this.eventStore.store({
|
await this.eventStore.store({
|
||||||
type: DROP_FEATURES,
|
type: DROP_FEATURES,
|
||||||
@ -100,7 +100,7 @@ class StateService {
|
|||||||
: await this.strategyStore.getStrategies();
|
: await this.strategyStore.getStrategies();
|
||||||
|
|
||||||
if (dropBeforeImport) {
|
if (dropBeforeImport) {
|
||||||
this.logger.info(`Dropping existing strategies`);
|
this.logger.info('Dropping existing strategies');
|
||||||
await this.strategyStore.dropStrategies();
|
await this.strategyStore.dropStrategies();
|
||||||
await this.eventStore.store({
|
await this.eventStore.store({
|
||||||
type: DROP_STRATEGIES,
|
type: DROP_STRATEGIES,
|
||||||
|
@ -11,5 +11,5 @@ exports.up = function(db, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.down = function(db, callback) {
|
exports.down = function(db, callback) {
|
||||||
db.runSql(`ALTER TABLE features DROP COLUMN "variants";`, callback);
|
db.runSql('ALTER TABLE features DROP COLUMN "variants";', callback);
|
||||||
};
|
};
|
||||||
|
@ -16,5 +16,5 @@ exports.up = function(db, cb) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.down = function(db, cb) {
|
exports.down = function(db, cb) {
|
||||||
db.runSql(`DROP TABLE addons;`, cb);
|
db.runSql('DROP TABLE addons;', cb);
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@ exports.up = function(db, cb) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.down = function(db, cb) {
|
exports.down = function(db, cb) {
|
||||||
db.runSql(`ALTER TABLE strategies DROP COLUMN deprecated`, cb);
|
db.runSql('ALTER TABLE strategies DROP COLUMN deprecated', cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports._meta = {
|
exports._meta = {
|
||||||
|
@ -146,7 +146,7 @@ test.serial('should not update with invalid addon configuration', async t => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await request
|
await request
|
||||||
.put(`/api/admin/addons/1`)
|
.put('/api/admin/addons/1')
|
||||||
.send(config)
|
.send(config)
|
||||||
.expect(400);
|
.expect(400);
|
||||||
});
|
});
|
||||||
@ -166,7 +166,7 @@ test.serial('should not update unknown addon configuration', async t => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await request
|
await request
|
||||||
.put(`/api/admin/addons/123123`)
|
.put('/api/admin/addons/123123')
|
||||||
.send(config)
|
.send(config)
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
@ -209,7 +209,7 @@ test.serial('should not get unknown addon configuration', async t => {
|
|||||||
t.plan(0);
|
t.plan(0);
|
||||||
const request = await setupApp(stores);
|
const request = await setupApp(stores);
|
||||||
|
|
||||||
await request.get(`/api/admin/addons/445`).expect(404);
|
await request.get('/api/admin/addons/445').expect(404);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('should not delete unknown addon configuration', async t => {
|
test.serial('should not delete unknown addon configuration', async t => {
|
||||||
|
@ -29,7 +29,7 @@ test.serial('should require authenticated user', async t => {
|
|||||||
new AuthenticationRequired({
|
new AuthenticationRequired({
|
||||||
path: '/api/admin/login',
|
path: '/api/admin/login',
|
||||||
type: 'custom',
|
type: 'custom',
|
||||||
message: `You have to identify yourself.`,
|
message: 'You have to identify yourself.',
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.end(),
|
.end(),
|
||||||
|
Loading…
Reference in New Issue
Block a user