Skip to content

Commit

Permalink
[Lists][Exceptions] - Adding basic linting, i18n and storybook support (
Browse files Browse the repository at this point in the history
#94772)

### Summary

In preparation for moving all the exceptions UI components into the lists plugin adds some linting, adds the lists plugin to the i18n config and adds storybook support. Tried to add a bit stricter linting than exists in the security solution right now, rules that we've talked about wanting to enable.
  • Loading branch information
yctercero authored Mar 17, 2021
1 parent 044a94a commit bbee40c
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 1 deletion.
57 changes: 56 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,62 @@ module.exports = {
},
},
{
// typescript and javascript for front and back end
// typescript for /public and /common
files: ['x-pack/plugins/lists/public/*.{ts,tsx}', 'x-pack/plugins/lists/common/*.{ts,tsx}'],
rules: {
'@typescript-eslint/no-for-in-array': 'error',
},
},
{
// typescript for /public and /common
files: ['x-pack/plugins/lists/public/*.{ts,tsx}', 'x-pack/plugins/lists/common/*.{ts,tsx}'],
plugins: ['react'],
env: {
jest: true,
},
rules: {
'react/boolean-prop-naming': 'error',
'react/button-has-type': 'error',
'react/display-name': 'error',
'react/forbid-dom-props': 'error',
'react/no-access-state-in-setstate': 'error',
'react/no-children-prop': 'error',
'react/no-danger-with-children': 'error',
'react/no-deprecated': 'error',
'react/no-did-mount-set-state': 'error',
'react/no-did-update-set-state': 'error',
'react/no-direct-mutation-state': 'error',
'react/no-find-dom-node': 'error',
'react/no-redundant-should-component-update': 'error',
'react/no-render-return-value': 'error',
'react/no-typos': 'error',
'react/no-string-refs': 'error',
'react/no-this-in-sfc': 'error',
'react/no-unescaped-entities': 'error',
'react/no-unsafe': 'error',
'react/no-unused-prop-types': 'error',
'react/no-unused-state': 'error',
'react/sort-comp': 'error',
'react/void-dom-elements-no-children': 'error',
'react/jsx-no-comment-textnodes': 'error',
'react/jsx-no-literals': 'error',
'react/jsx-no-target-blank': 'error',
'react/jsx-fragments': 'error',
'react/jsx-sort-default-props': 'error',
},
},
{
files: ['x-pack/plugins/lists/public/**/!(*.test).{js,mjs,ts,tsx}'],
plugins: ['react-perf'],
rules: {
'react-perf/jsx-no-new-object-as-prop': 'error',
'react-perf/jsx-no-new-array-as-prop': 'error',
'react-perf/jsx-no-new-function-as-prop': 'error',
'react/jsx-no-bind': 'error',
},
},
{
// typescript and javascript for front and back
files: ['x-pack/plugins/lists/**/*.{js,mjs,ts,tsx}'],
plugins: ['eslint-plugin-node'],
env: {
Expand Down
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export const storybookAliases = {
ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/.storybook',
observability: 'x-pack/plugins/observability/.storybook',
presentation: 'src/plugins/presentation_util/storybook',
lists: 'x-pack/plugins/lists/.storybook',
};
1 change: 1 addition & 0 deletions test/scripts/jenkins_storybook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ yarn storybook --site security_solution
yarn storybook --site ui_actions_enhanced
yarn storybook --site observability
yarn storybook --site presentation
yarn storybook --site lists
1 change: 1 addition & 0 deletions x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"xpack.lens": "plugins/lens",
"xpack.licenseMgmt": "plugins/license_management",
"xpack.licensing": "plugins/licensing",
"xpack.lists": "plugins/lists",
"xpack.logstash": ["plugins/logstash"],
"xpack.main": "legacy/plugins/xpack_main",
"xpack.maps": ["plugins/maps"],
Expand Down
8 changes: 8 additions & 0 deletions x-pack/plugins/lists/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

module.exports = require('@kbn/storybook').defaultConfig;

0 comments on commit bbee40c

Please sign in to comment.