Browse Source

Increase files checked by ESLint (#9705)

tags/v2.7.0rc1
Yamagishi Kazutoshi 11 months ago
parent
commit
d5bdfaf0bb
7 changed files with 218 additions and 214 deletions
  1. 13
    30
      .eslintignore
  2. 199
    0
      .eslintrc.js
  3. 0
    172
      .eslintrc.yml
  4. 2
    2
      package.json
  5. 4
    10
      postcss.config.js
  6. 0
    0
      vendor/.keep
  7. 0
    0
      vendor/assets/stylesheets/.keep

+ 13
- 30
.eslintignore View File

@@ -1,30 +1,13 @@
1
-# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
-#
3
-# If you find yourself ignoring temporary files generated by your text editor
4
-# or operating system, you probably want to add a global ignore instead:
5
-#   git config --global core.excludesfile '~/.gitignore_global'
6
-
7
-# Ignore bundler config.
8
-/.bundle
9
-
10
-# Ignore the default SQLite database.
11
-/db/*.sqlite3
12
-/db/*.sqlite3-journal
13
-
14
-# Ignore all logfiles and tempfiles.
15
-/log/*
16
-!/log/.keep
17
-/tmp
18
-coverage
19
-public/system
20
-public/assets
21
-.env
22
-.env.production
23
-node_modules/
24
-neo4j/
25
-
26
-# Ignore Vagrant files
27
-.vagrant/
28
-
29
-# Ignore Capistrano customizations
30
-config/deploy/*
1
+/build/**
2
+/coverage/**
3
+/db/**
4
+/lib/**
5
+/log/**
6
+/node_modules/**
7
+/nonobox/**
8
+/public/**
9
+!/public/embed.js
10
+/spec/**
11
+/tmp/**
12
+/vendor/**
13
+!.eslintrc.js

+ 199
- 0
.eslintrc.js View File

@@ -0,0 +1,199 @@
1
+module.exports = {
2
+  root: true,
3
+
4
+  env: {
5
+    browser: true,
6
+    node: true,
7
+    es6: true,
8
+    jest: true,
9
+  },
10
+
11
+  globals: {
12
+    ATTACHMENT_HOST: false,
13
+  },
14
+
15
+  parser: 'babel-eslint',
16
+
17
+  plugins: [
18
+    'react',
19
+    'jsx-a11y',
20
+    'import',
21
+    'promise',
22
+  ],
23
+
24
+  parserOptions: {
25
+    sourceType: 'module',
26
+    ecmaFeatures: {
27
+      experimentalObjectRestSpread: true,
28
+      jsx: true,
29
+    },
30
+    ecmaVersion: 2018,
31
+  },
32
+
33
+  settings: {
34
+    react: {
35
+      version: 'detect',
36
+    },
37
+    'import/extensions': [
38
+      '.js',
39
+    ],
40
+    'import/ignore': [
41
+      'node_modules',
42
+      '\\.(css|scss|json)$',
43
+    ],
44
+  },
45
+
46
+  rules: {
47
+    'brace-style': 'warn',
48
+    'comma-dangle': ['error', 'always-multiline'],
49
+    'comma-spacing': [
50
+      'warn',
51
+      {
52
+        before: false,
53
+        after: true,
54
+      },
55
+    ],
56
+    'comma-style': ['warn', 'last'],
57
+    'consistent-return': 'error',
58
+    'dot-notation': 'error',
59
+    eqeqeq: 'error',
60
+    indent: ['warn', 2],
61
+    'jsx-quotes': ['error', 'prefer-single'],
62
+    'no-catch-shadow': 'error',
63
+    'no-cond-assign': 'error',
64
+    'no-console': [
65
+      'warn',
66
+      {
67
+        allow: [
68
+          'error',
69
+          'warn',
70
+        ],
71
+      },
72
+    ],
73
+    'no-fallthrough': 'error',
74
+    'no-irregular-whitespace': 'error',
75
+    'no-mixed-spaces-and-tabs': 'warn',
76
+    'no-nested-ternary': 'warn',
77
+    'no-trailing-spaces': 'warn',
78
+    'no-undef': 'error',
79
+    'no-unreachable': 'error',
80
+    'no-unused-expressions': 'error',
81
+    'no-unused-vars': [
82
+      'error',
83
+      {
84
+        vars: 'all',
85
+        args: 'after-used',
86
+        ignoreRestSiblings: true,
87
+      },
88
+    ],
89
+    'object-curly-spacing': ['error', 'always'],
90
+    'padded-blocks': [
91
+      'error',
92
+      {
93
+        classes: 'always',
94
+      },
95
+    ],
96
+    quotes: ['error', 'single'],
97
+    semi: 'error',
98
+    strict: 'off',
99
+    'valid-typeof': 'error',
100
+
101
+    'react/jsx-boolean-value': 'error',
102
+    'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
103
+    'react/jsx-curly-spacing': 'error',
104
+    'react/jsx-equals-spacing': 'error',
105
+    'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
106
+    'react/jsx-indent': ['error', 2],
107
+    'react/jsx-no-bind': 'error',
108
+    'react/jsx-no-duplicate-props': 'error',
109
+    'react/jsx-no-undef': 'error',
110
+    'react/jsx-tag-spacing': 'error',
111
+    'react/jsx-uses-react': 'error',
112
+    'react/jsx-uses-vars': 'error',
113
+    'react/jsx-wrap-multilines': 'error',
114
+    'react/no-multi-comp': 'off',
115
+    'react/no-string-refs': 'error',
116
+    'react/prop-types': 'error',
117
+    'react/self-closing-comp': 'error',
118
+
119
+    'jsx-a11y/accessible-emoji': 'warn',
120
+    'jsx-a11y/alt-text': 'warn',
121
+    'jsx-a11y/anchor-has-content': 'warn',
122
+    'jsx-a11y/anchor-is-valid': [
123
+      'warn',
124
+      {
125
+        components: [
126
+          'Link',
127
+          'NavLink',
128
+        ],
129
+        specialLink: [
130
+          'to',
131
+        ],
132
+        aspect: [
133
+          'noHref',
134
+          'invalidHref',
135
+          'preferButton',
136
+        ],
137
+      },
138
+    ],
139
+    'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
140
+    'jsx-a11y/aria-props': 'warn',
141
+    'jsx-a11y/aria-proptypes': 'warn',
142
+    'jsx-a11y/aria-role': 'warn',
143
+    'jsx-a11y/aria-unsupported-elements': 'warn',
144
+    'jsx-a11y/heading-has-content': 'warn',
145
+    'jsx-a11y/html-has-lang': 'warn',
146
+    'jsx-a11y/iframe-has-title': 'warn',
147
+    'jsx-a11y/img-redundant-alt': 'warn',
148
+    'jsx-a11y/interactive-supports-focus': 'warn',
149
+    'jsx-a11y/label-has-for': 'off',
150
+    'jsx-a11y/mouse-events-have-key-events': 'warn',
151
+    'jsx-a11y/no-access-key': 'warn',
152
+    'jsx-a11y/no-distracting-elements': 'warn',
153
+    'jsx-a11y/no-noninteractive-element-interactions': [
154
+      'warn',
155
+      {
156
+        handlers: [
157
+          'onClick',
158
+        ],
159
+      },
160
+    ],
161
+    'jsx-a11y/no-onchange': 'warn',
162
+    'jsx-a11y/no-redundant-roles': 'warn',
163
+    'jsx-a11y/no-static-element-interactions': [
164
+      'warn',
165
+      {
166
+        handlers: [
167
+          'onClick',
168
+        ],
169
+      },
170
+    ],
171
+    'jsx-a11y/role-has-required-aria-props': 'warn',
172
+    'jsx-a11y/role-supports-aria-props': 'off',
173
+    'jsx-a11y/scope': 'warn',
174
+    'jsx-a11y/tabindex-no-positive': 'warn',
175
+
176
+    'import/extensions': [
177
+      'error',
178
+      'always',
179
+      {
180
+        js: 'never',
181
+      },
182
+    ],
183
+    'import/newline-after-import': 'error',
184
+    'import/no-extraneous-dependencies': [
185
+      'error',
186
+      {
187
+        devDependencies: [
188
+          'config/webpack/**',
189
+          'app/javascript/mastodon/test_setup.js',
190
+          'app/javascript/**/__tests__/**',
191
+        ],
192
+      },
193
+    ],
194
+    'import/no-unresolved': 'error',
195
+    'import/no-webpack-loader-syntax': 'error',
196
+
197
+    'promise/catch-or-return': 'error',
198
+  },
199
+};

+ 0
- 172
.eslintrc.yml View File

@@ -1,172 +0,0 @@
1
----
2
-root: true
3
-
4
-env:
5
-  browser: true
6
-  node: true
7
-  es6: true
8
-  jest: true
9
-
10
-globals:
11
-  ATTACHMENT_HOST: false
12
-
13
-parser: babel-eslint
14
-
15
-plugins:
16
-- react
17
-- jsx-a11y
18
-- import
19
-- promise
20
-
21
-parserOptions:
22
-  sourceType: module
23
-  ecmaFeatures:
24
-    experimentalObjectRestSpread: true
25
-    jsx: true
26
-  ecmaVersion: 2018
27
-
28
-settings:
29
-  react:
30
-    version: detect
31
-  import/extensions:
32
-  - .js
33
-  import/ignore:
34
-  - node_modules
35
-  - \\.(css|scss|json)$
36
-
37
-rules:
38
-  brace-style: warn
39
-  comma-dangle:
40
-  - error
41
-  - always-multiline
42
-  comma-spacing:
43
-  - warn
44
-  - before: false
45
-    after: true
46
-  comma-style:
47
-  - warn
48
-  - last
49
-  consistent-return: error
50
-  dot-notation: error
51
-  eqeqeq: error
52
-  indent:
53
-  - warn
54
-  - 2
55
-  jsx-quotes:
56
-  - error
57
-  - prefer-single
58
-  no-catch-shadow: error
59
-  no-cond-assign: error
60
-  no-console:
61
-  - warn
62
-  - allow:
63
-    - error
64
-    - warn
65
-  no-fallthrough: error
66
-  no-irregular-whitespace: error
67
-  no-mixed-spaces-and-tabs: warn
68
-  no-nested-ternary: warn
69
-  no-trailing-spaces: warn
70
-  no-undef: error
71
-  no-unreachable: error
72
-  no-unused-expressions: error
73
-  no-unused-vars:
74
-  - error
75
-  - vars: all
76
-    args: after-used
77
-    ignoreRestSiblings: true
78
-  object-curly-spacing:
79
-  - error
80
-  - always
81
-  padded-blocks:
82
-  - error
83
-  - classes: always
84
-  quotes:
85
-  - error
86
-  - single
87
-  semi: error
88
-  strict: off
89
-  valid-typeof: error
90
-
91
-  react/jsx-boolean-value: error
92
-  react/jsx-closing-bracket-location:
93
-  - error
94
-  - line-aligned
95
-  react/jsx-curly-spacing: error
96
-  react/jsx-equals-spacing: error
97
-  react/jsx-first-prop-new-line:
98
-  - error
99
-  - multiline-multiprop
100
-  react/jsx-indent:
101
-  - error
102
-  - 2
103
-  react/jsx-no-bind: error
104
-  react/jsx-no-duplicate-props: error
105
-  react/jsx-no-undef: error
106
-  react/jsx-tag-spacing: error
107
-  react/jsx-uses-react: error
108
-  react/jsx-uses-vars: error
109
-  react/jsx-wrap-multilines: error
110
-  react/no-multi-comp: off
111
-  react/no-string-refs: error
112
-  react/prop-types: error
113
-  react/self-closing-comp: error
114
-
115
-  jsx-a11y/accessible-emoji: warn
116
-  jsx-a11y/alt-text: warn
117
-  jsx-a11y/anchor-has-content: warn
118
-  jsx-a11y/anchor-is-valid:
119
-  - warn
120
-  - components:
121
-    - Link
122
-    - NavLink
123
-    specialLink:
124
-    - to
125
-    aspect:
126
-    - noHref
127
-    - invalidHref
128
-    - preferButton
129
-  jsx-a11y/aria-activedescendant-has-tabindex: warn
130
-  jsx-a11y/aria-props: warn
131
-  jsx-a11y/aria-proptypes: warn
132
-  jsx-a11y/aria-role: warn
133
-  jsx-a11y/aria-unsupported-elements: warn
134
-  jsx-a11y/heading-has-content: warn
135
-  jsx-a11y/html-has-lang: warn
136
-  jsx-a11y/iframe-has-title: warn
137
-  jsx-a11y/img-redundant-alt: warn
138
-  jsx-a11y/interactive-supports-focus: warn
139
-  jsx-a11y/label-has-for: off
140
-  jsx-a11y/mouse-events-have-key-events: warn
141
-  jsx-a11y/no-access-key: warn
142
-  jsx-a11y/no-distracting-elements: warn
143
-  jsx-a11y/no-noninteractive-element-interactions:
144
-  - warn
145
-  - handlers:
146
-    - onClick
147
-  jsx-a11y/no-onchange: warn
148
-  jsx-a11y/no-redundant-roles: warn
149
-  jsx-a11y/no-static-element-interactions:
150
-  - warn
151
-  - handlers:
152
-    - onClick
153
-  jsx-a11y/role-has-required-aria-props: warn
154
-  jsx-a11y/role-supports-aria-props: off
155
-  jsx-a11y/scope: warn
156
-  jsx-a11y/tabindex-no-positive: warn
157
-
158
-  import/extensions:
159
-  - error
160
-  - always
161
-  - js: never
162
-  import/newline-after-import: error
163
-  import/no-extraneous-dependencies:
164
-  - error
165
-  - devDependencies:
166
-    - "config/webpack/**"
167
-    - "app/javascript/mastodon/test_setup.js"
168
-    - "app/javascript/**/__tests__/**"
169
-  import/no-unresolved: error
170
-  import/no-webpack-loader-syntax: error
171
-
172
-  promise/catch-or-return: error

+ 2
- 2
package.json View File

@@ -10,8 +10,8 @@
10 10
     "build:production": "cross-env RAILS_ENV=production NODE_ENV=production ./bin/webpack",
11 11
     "manage:translations": "node ./config/webpack/translationRunner.js",
12 12
     "start": "node ./streaming/index.js",
13
-    "test": "npm run test:lint && npm run test:jest",
14
-    "test:lint": "eslint -c .eslintrc.yml --ext=js app/javascript/ config/webpack/ streaming/",
13
+    "test": "${npm_execpath} run test:lint && ${npm_execpath} run test:jest",
14
+    "test:lint": "eslint --ext=js .",
15 15
     "test:jest": "cross-env NODE_ENV=test jest --coverage"
16 16
   },
17 17
   "repository": {

+ 4
- 10
postcss.config.js View File

@@ -1,13 +1,7 @@
1
-module.exports = {
1
+module.exports = ({ env }) => ({
2 2
   plugins: {
3
-    autoprefixer: {
4
-      browsers: [
5
-        'last 2 versions',
6
-        'IE >= 11',
7
-        'iOS >= 9',
8
-      ],
9
-    },
3
+    autoprefixer: {},
10 4
     'postcss-object-fit-images': {},
11
-    cssnano: {},
5
+    cssnano: env === 'production' ? {} : false,
12 6
   },
13
-};
7
+});

vendor/assets/javascripts/.keep → vendor/.keep View File


+ 0
- 0
vendor/assets/stylesheets/.keep View File


Loading…
Cancel
Save