Move ESLint configs to overrides (#24370)
This commit is contained in:
		
							parent
							
								
									eb171b7ce4
								
							
						
					
					
						commit
						d0bf149232
					
				
					 5 changed files with 36 additions and 7 deletions
				
			
		
							
								
								
									
										36
									
								
								.eslintrc.js
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								.eslintrc.js
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -13,7 +13,6 @@ module.exports = {
 | 
			
		|||
    browser: true,
 | 
			
		||||
    node: true,
 | 
			
		||||
    es6: true,
 | 
			
		||||
    jest: true,
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  globals: {
 | 
			
		||||
| 
						 | 
				
			
			@ -42,9 +41,7 @@ module.exports = {
 | 
			
		|||
      presets: ['@babel/react', '@babel/env'],
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  extends: [
 | 
			
		||||
    'plugin:import/typescript',
 | 
			
		||||
  ],
 | 
			
		||||
 | 
			
		||||
  settings: {
 | 
			
		||||
    react: {
 | 
			
		||||
      version: 'detect',
 | 
			
		||||
| 
						 | 
				
			
			@ -203,6 +200,7 @@ module.exports = {
 | 
			
		|||
      {
 | 
			
		||||
        devDependencies: [
 | 
			
		||||
          'config/webpack/**',
 | 
			
		||||
          'app/javascript/mastodon/performance.js',
 | 
			
		||||
          'app/javascript/mastodon/test_setup.js',
 | 
			
		||||
          'app/javascript/**/__tests__/**',
 | 
			
		||||
        ],
 | 
			
		||||
| 
						 | 
				
			
			@ -238,5 +236,35 @@ module.exports = {
 | 
			
		|||
        sourceType: 'script',
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      files: [
 | 
			
		||||
        '**/*.ts',
 | 
			
		||||
        '**/*.tsx',
 | 
			
		||||
      ],
 | 
			
		||||
 | 
			
		||||
      extends: [
 | 
			
		||||
        'eslint:recommended',
 | 
			
		||||
        'plugin:@typescript-eslint/recommended',
 | 
			
		||||
        'plugin:react/recommended',
 | 
			
		||||
        'plugin:jsx-a11y/recommended',
 | 
			
		||||
        'plugin:import/recommended',
 | 
			
		||||
        'plugin:import/typescript',
 | 
			
		||||
        'plugin:promise/recommended',
 | 
			
		||||
      ],
 | 
			
		||||
 | 
			
		||||
      rules: {
 | 
			
		||||
        '@typescript-eslint/no-explicit-any': 'off',
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      files: [
 | 
			
		||||
        '**/__tests__/*.js',
 | 
			
		||||
        '**/__tests__/*.jsx',
 | 
			
		||||
      ],
 | 
			
		||||
 | 
			
		||||
      env: {
 | 
			
		||||
        jest: true,
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  ],
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ if (process.env.NODE_ENV === 'development') {
 | 
			
		|||
    // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1331135
 | 
			
		||||
    performance.setResourceTimingBufferSize(Infinity);
 | 
			
		||||
  }
 | 
			
		||||
  // eslint-disable-next-line import/no-extraneous-dependencies
 | 
			
		||||
 | 
			
		||||
  marky = require('marky');
 | 
			
		||||
  // allows us to easily do e.g. ReactPerf.printWasted() while debugging
 | 
			
		||||
  //window.ReactPerf = require('react-addons-perf');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
 | 
			
		||||
const checkNotificationPromise = () => {
 | 
			
		||||
  try {
 | 
			
		||||
    // eslint-disable-next-line promise/catch-or-return
 | 
			
		||||
    // eslint-disable-next-line promise/valid-params, promise/catch-or-return
 | 
			
		||||
    Notification.requestPermission().then();
 | 
			
		||||
  } catch(e) {
 | 
			
		||||
    return false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,4 +17,5 @@ function formatPublicPath(host = '', path = '') {
 | 
			
		|||
 | 
			
		||||
const cdnHost = document.querySelector('meta[name=cdn-host]');
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line no-undef
 | 
			
		||||
__webpack_public_path__ = formatPublicPath(cdnHost ? cdnHost.content : '', process.env.PUBLIC_OUTPUT_PATH);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -211,7 +211,7 @@
 | 
			
		|||
  },
 | 
			
		||||
  "lint-staged": {
 | 
			
		||||
    "*": "prettier --ignore-unknown --write",
 | 
			
		||||
    "*.{js,jsx}": "eslint --fix",
 | 
			
		||||
    "*.{js,jsx,ts,tsx}": "eslint --fix",
 | 
			
		||||
    "*.{css,scss}": "stylelint --fix"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue