@zimbra/eslint-config 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zimbra/eslint-config",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "description": "ESLint configuration for Zimbra javascript projects.",
6
6
  "main": "src/index.js",
@@ -14,6 +14,7 @@ import importPlugin from 'eslint-plugin-import';
14
14
  import styleRules from '../rules/style.js';
15
15
  import reactRules from '../rules/react.js';
16
16
  import reactHooksRules from '../rules/react-hooks.js';
17
+ import securityRules from '../rules/security.js';
17
18
  import importRules from '../rules/import.js';
18
19
  import { i18nRules, LANGUAGE_FILES_RELATIVE, i18nTextComponents } from '../rules/i18n.js';
19
20
  import prettierRules from '../rules/prettier.js';
@@ -25,6 +26,7 @@ const coreRules = {
25
26
  ...reactHooksRules,
26
27
  ...importRules,
27
28
  ...prettierRules,
29
+ ...securityRules,
28
30
  ...i18nRules
29
31
  };
30
32
 
@@ -69,7 +71,8 @@ export default [
69
71
  },
70
72
 
71
73
  settings: {
72
- react: { pragma: 'createElement', version: '16.3' },
74
+ // Requires exactly version 16.0. See: https://github.com/jsx-eslint/eslint-plugin-react/issues/1754
75
+ react: { pragma: 'createElement', version: '16.0' },
73
76
  'preact-i18n': {
74
77
  languageFiles: languageFilesAbsolute,
75
78
  textComponents: i18nTextComponents
package/src/rules/i18n.js CHANGED
@@ -10,6 +10,7 @@ const CUSTOM_SORT_PATH = path.join(__dirname, '../../scripts/intl/lint-custom-so
10
10
 
11
11
  // i18n-json rules
12
12
  export const i18nJsonRules = {
13
+ 'i18n-json/valid-message-syntax': ['error', { syntax: 'non-empty-string' }],
13
14
  'i18n-json/sorted-keys': [
14
15
  'error',
15
16
  {
@@ -0,0 +1,8 @@
1
+ export const securityRules = {
2
+ 'no-eval': 2,
3
+ 'no-implied-eval': 2,
4
+ 'no-new-func': 2,
5
+ 'react/no-danger': 'error'
6
+ };
7
+
8
+ export default securityRules;
@@ -1,4 +1,14 @@
1
1
  export const styleRules = {
2
+ 'new-cap': 1,
3
+ 'no-console': [1, { allow: ['warn', 'error'] }],
4
+ 'no-shadow-restricted-names': 2,
5
+ 'no-shadow': 'error',
6
+ eqeqeq: ['error', 'smart'],
7
+ camelcase: [1, { properties: 'never' }],
8
+ 'guard-for-in': 2,
9
+ 'prefer-rest-params': 2,
10
+ 'no-alert': 'error',
11
+
2
12
  // TODO: Fully enable this rule once the codebase is updated to follow best practices
3
13
  'no-unused-vars': [
4
14
  'error',