Rename some files to .cjs, make the codebase aware of .cjs and .mjs extensions

environments/review-cjs-6wsy1v/deployments/2333
Alex Gleason 2023-01-17 18:34:11 -06:00
rodzic 988d466fcd
commit 54eae01255
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
14 zmienionych plików z 17 dodań i 10 usunięć

Wyświetl plik

@ -5,4 +5,4 @@
/tmp/** /tmp/**
/coverage/** /coverage/**
/custom/** /custom/**
!.eslintrc.js !.eslintrc.cjs

Wyświetl plik

@ -43,7 +43,7 @@ module.exports = {
react: { react: {
version: 'detect', version: 'detect',
}, },
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'], 'import/extensions': ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx'],
'import/ignore': [ 'import/ignore': [
'node_modules', 'node_modules',
'\\.(css|scss|json)$', '\\.(css|scss|json)$',

Wyświetl plik

@ -48,10 +48,12 @@ lint-js:
changes: changes:
- "**/*.js" - "**/*.js"
- "**/*.jsx" - "**/*.jsx"
- "**/*.cjs"
- "**/*.mjs"
- "**/*.ts" - "**/*.ts"
- "**/*.tsx" - "**/*.tsx"
- ".eslintignore" - ".eslintignore"
- ".eslintrc.js" - ".eslintrc.cjs"
lint-sass: lint-sass:
stage: test stage: test
@ -72,7 +74,7 @@ jest:
- "app/soapbox/**/*" - "app/soapbox/**/*"
- "webpack/**/*" - "webpack/**/*"
- "custom/**/*" - "custom/**/*"
- "jest.config.js" - "jest.config.cjs"
- "package.json" - "package.json"
- "yarn.lock" - "yarn.lock"
- ".gitlab-ci.yml" - ".gitlab-ci.yml"

Wyświetl plik

@ -1,5 +1,8 @@
{ {
"*.js": "eslint --cache", "*.js": "eslint --cache",
"*.cjs": "eslint --cache",
"*.mjs": "eslint --cache",
"*.ts": "eslint --cache", "*.ts": "eslint --cache",
"*.tsx": "eslint --cache",
"app/styles/**/*.scss": "stylelint" "app/styles/**/*.scss": "stylelint"
} }

Wyświetl plik

@ -18,6 +18,8 @@ module.exports = {
], ],
'collectCoverageFrom': [ 'collectCoverageFrom': [
'app/soapbox/**/*.js', 'app/soapbox/**/*.js',
'app/soapbox/**/*.cjs',
'app/soapbox/**/*.mjs',
'app/soapbox/**/*.ts', 'app/soapbox/**/*.ts',
'app/soapbox/**/*.tsx', 'app/soapbox/**/*.tsx',
'!app/soapbox/features/emoji/emoji-compressed.js', '!app/soapbox/features/emoji/emoji-compressed.js',
@ -43,6 +45,6 @@ module.exports = {
], ],
'transform': { 'transform': {
'\\.[jt]sx?$': 'babel-jest', '\\.[jt]sx?$': 'babel-jest',
[`\\.(${ASSET_EXTS})$`]: '<rootDir>/jest/assetTransformer.js', [`\\.(${ASSET_EXTS})$`]: '<rootDir>/jest/assetTransformer.cjs',
}, },
}; };

Wyświetl plik

@ -25,7 +25,7 @@
"test:coverage": "${npm_execpath} run test --coverage", "test:coverage": "${npm_execpath} run test --coverage",
"test:all": "${npm_execpath} run test:coverage && ${npm_execpath} run lint", "test:all": "${npm_execpath} run test:coverage && ${npm_execpath} run lint",
"lint": "${npm_execpath} run lint:js && ${npm_execpath} run lint:sass", "lint": "${npm_execpath} run lint:js && ${npm_execpath} run lint:sass",
"lint:js": "npx eslint --ext .js,.jsx,.ts,.tsx . --cache", "lint:js": "npx eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx . --cache",
"lint:sass": "npx stylelint app/styles/**/*.scss", "lint:sass": "npx stylelint app/styles/**/*.scss",
"prepare": "husky install" "prepare": "husky install"
}, },

Wyświetl plik

@ -1,4 +1,4 @@
const { parseColorMatrix } = require('./tailwind/colors'); const { parseColorMatrix } = require('./tailwind/colors.cjs');
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {

Wyświetl plik

@ -1,7 +1,7 @@
import { import {
withOpacityValue, withOpacityValue,
parseColorMatrix, parseColorMatrix,
} from '../colors'; } from '../colors.cjs';
describe('withOpacityValue()', () => { describe('withOpacityValue()', () => {
it('returns a Tailwind color function with alpha support', () => { it('returns a Tailwind color function with alpha support', () => {

Wyświetl plik

@ -12,7 +12,7 @@ const settings = {
test_root_path: `${FE_BUILD_DIR}-test`, test_root_path: `${FE_BUILD_DIR}-test`,
cache_path: 'tmp/cache', cache_path: 'tmp/cache',
resolved_paths: [], resolved_paths: [],
extensions: [ '.mjs', '.js', '.jsx', '.ts', '.tsx', '.sass', '.scss', '.css', '.module.sass', '.module.scss', '.module.css', '.png', '.svg', '.gif', '.jpeg', '.jpg' ], extensions: [ '.js', '.jsx', '.cjs', '.mjs', '.ts', '.tsx', '.sass', '.scss', '.css', '.module.sass', '.module.scss', '.module.css', '.png', '.svg', '.gif', '.jpeg', '.jpg' ],
}; };
const outputDir = env.NODE_ENV === 'test' ? settings.test_root_path : settings.public_root_path; const outputDir = env.NODE_ENV === 'test' ? settings.test_root_path : settings.public_root_path;

Wyświetl plik

@ -7,7 +7,7 @@ import type { RuleSetRule } from 'webpack';
const isDevelopment = process.env.NODE_ENV === 'development'; const isDevelopment = process.env.NODE_ENV === 'development';
const rule: RuleSetRule = { const rule: RuleSetRule = {
test: /\.(js|jsx|mjs|ts|tsx)$/, test: /\.(js|jsx|cjs|mjs|ts|tsx)$/,
include: [ include: [
settings.source_path, settings.source_path,
...settings.resolved_paths, ...settings.resolved_paths,